Hi Looking for a way to use the determine the position of a card in a grid
using the mouse click event in Python. Code is attached. There are no
viruses.
Unfortunately using Tinkter grids / frames can't determine between the two
demo cards.
Any suggestions are welcome
--
Dave Merrick
TutorInve
Hi Looking for a way to use the determine the position of a card in a grid
using the mouse click event in Python. Code is attached.
Unfortunately using Tinkter grids / frames can't determine between the two
demo cards.
The Relevant code is below
def showCardInitial(cardList):
cardsToPlay = [
class Node:
def __init__(self,initdata):
self.data = initdata
self.next = None
def getData(self):
return self.data
def getNext(self):
return self.next
def setdata(self,newData):
self.data = newData
def setNext(self,newnext):
sel
##from stack import Stack
class Stack:
def __init__(self):
self.items =[]
def isEmpty(self):
return self.items ==[]
def push(self,item):
self.items.append(item)
def pop(self,item):
self.items.pop()
def peek(self):
return self.items[l
I want to install the first module
http://code.google.com/p/python-nose/downloads/list
--
Dave Merrick
merrick...@gmail.com
Ph 03 3423 121
Cell 027 3089 169
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http
HI. I feel I'm starting to go round in circles solving this problem. I feel
I made significant progress.
Can someone help me iron out the bugs please
# Blackjack
# From 1 to 7 players compete against a dealer
import cards, games
class BJ_Card(cards.Card):
""" A Blackjack Card. """
ACE_VA
Each player needs to be able to bet
# Blackjack
# From 1 to 7 players compete against a dealer
import cards, games
class BJ_Card(cards.Card):
""" A Blackjack Card. """
ACE_VALUE = 1
@property
def value(self):
if self.is_face_up:
v = BJ_Card.RANKS.index(self.r
# Blackjack
# From 1 to 7 players compete against a dealer
import cards, games
class BJ_Card(cards.Card):
""" A Blackjack Card. """
ACE_VALUE = 1
@property
def value(self):
if self.is_face_up:
v = BJ_Card.RANKS.index(self.rank) + 1
if v > 10:
# Guess My Number GUI
# Create a story based on user input
from tkinter import *
import random
class Application(Frame):
""" GUI application that creates a story based on user input. """
def __init__(self, master):
""" Initialize Frame. """
super(Application, self).__init__
Thanks that should help
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Is it possible too have
crit1 = Critter("Dave")
crit2 = Critter("Sweetie")
farm = [crit1,crit2] #List#
and then be able to use Critters methods on farm?
# Critter Caretaker
# A virtual pet to care for
class Critter(object):
"""A virtual pet"""
def __init__(self, name, hunger = 0, bore
Can someone show me how to code this correctly please?
# Critter Caretaker
# A virtual pet to care for
class Critter(object):
"""A virtual pet"""
def __init__(self, name, hunger = 0, boredom = 0):
self.name = name
self.hunger = hunger
self.boredom = boredom
#
>
> Can someone show me how to code this correctly please
>
> > class Critter(object):
> >
> >def __init__(self, name, hunger = 0, boredom = 0):
> >def __pass_time(self):
> >def __str__(self):
> >@property
> >def mood(self):
> >def talk(self):
> >def eat(self):
> >de
011 08:58:03 +0100
> From: "Alan Gauld"
> To: tutor@python.org
> Subject: Re: [Tutor] Class methods
> Message-ID:
> Content-Type: text/plain; format=flowed; charset="UTF-8";
>reply-type=original
>
> "David Merrick" wrote
>
>
# Critter Caretaker
# A virtual pet to care for
class Critter(object):
"""A virtual pet"""
def __init__(self, name, hunger = 0, boredom = 0):
self.name = name
self.hunger = hunger
self.boredom = boredom
# __ denotes private method
def __pass_time(self):
I have created a Critter object and a Farm object which is two critters. I
want to use Critters methods in the Farm object as it just 2 critters in a
list
crit1 = Critter("Sweetie")
crit2 = Critter("Dave")
farmlet = [crit1,crit2]
# Critter Caretaker
> # A virtual pet to care for
> class Critter(
I need help using Class methods in another class. I have a class called
Critter and I want to create two critters in a farm Class Farm and use
Class Critter's methods
--
Dave Merrick
merrick...@gmail.com
Ph 03 3423 121
Cell 027 3089 169
critter_farm2.py
Description: Binary data
___
I need help using Class methods in another class. I have a class called
Critter and I want to create two critters in a farm Class Farm and use
Class Critter's methods
# A virtual pet to care for
class Critter(object):
"""A virtual pet"""
def __init__(self, name, hunger = 0, boredom = 0):
# Critter Caretaker
# A virtual pet to care for
class Farm(object):
#A collection of Critters
def talk(self,farm):
farm.talk()
class Critter(object):
"""A virtual pet"""
def __init__(self, name, hunger = 0, boredom = 0):
self.name = name
self.hunger = hunger
As a new user of Pytrhon and previous user of Java,C(+),Php. There is very
little difference. In some cases Python might be slower but I don't think it
would mnake that much difference. The major differnce is the syntax of how
you write and layout your code.
Chreers Dave
On Sat, May 28, 2011 at 1
How do I can access to the math module to use PI?
area = math.pi * pow(3,2)
Traceback (most recent call last):
File "", line 1, in
area = math.i * pow(3,2)
NameError: name 'math' is not defined
--
Dave Merrick
merrick...@gmail.com
Ph 03 3423 121
Cell 027 3089 169
_
21 matches
Mail list logo