[EMAIL PROTECTED] wrote:
Beginner, so please bare with me. I'm not sure what to call what it
is I'm looking for.
If I have an object class, let's call it "Creature":
class Creature:
def __init__(self, status):
self.status = "happy"
def change_status(self, new_status):
self.status = new_status
def print_status(self):
print self.status
I would like to be able to print out the Creature's status every 20
seconds. Let's say I use a script like this:
import time
while True:
time.sleep(20)
Creature.print_status()
But, while cycling through printing the status, I would like to be
able to update Creature.status to something new.
To answer your question, we need to know from where you would derive the
directions to change the status. For instance:
* time based (random or periodically scheduled)
* user mouse/keyboard action
* some state external to the program (file content, socket data, phase
of the moon, price of tea in China, ...)
Each of those possibilities would require a substantially different
approach.
Gary Herron
I might be approaching this from the wrong direction entirely. Thanks
for your input.
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list