![]() |
|
#1
|
|||
|
|||
|
Wait for function to return?
Hi all
I want to stop the execution of my script until a function returns. The idea is to stop the script when starting a task, where the user has to press a key (P), and as soon as he presses the key, the script should continue. Code:
class Experiment:
# This method is called somewhere...
def start_green_face_task(self):
self.avatar_to_morph().make_green_face()
self.test_reaction_time() # Here the code should stop until this method returns (when the user presses P)! But how can this be achieved?
self.end_green_face_task() # This method should be called *after* the user presses P!
def test_reaction_time(self):
while True:
yield self.viztask.waitKeyDown('P', d)
return
def end_green_face_task(self):
self.avatar_to_morph().remove_green_face()
yield self.test_reaction_time() or self.viztask.schedule(self.test_reaction_time()) but somehow this doesn't do what I need... Thanks very much for help! Josh |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| return variable from keypress function | starbug | Vizard | 2 | 01-07-2010 12:14 PM |
| return IDE to default config | billjarrold | Vizard | 2 | 12-10-2009 07:05 PM |
| Sit, stay, wait? | EnvisMJ | Vizard | 1 | 05-20-2009 05:36 PM |
| Unexpected carriage return | vizmaster | Vizard | 3 | 01-23-2007 01:46 PM |
| plug-ins that return quaternions | hotspur1 | Vizard | 2 | 02-05-2004 08:47 PM |