#1
|
|||
|
|||
Arranging Scenes in Correct Order
I am a relative newbie to Python and Vizard despite being more familiar with other programming languages. I am sure this question has been asked over a thousand times, but here goes again!
I have taken over a project at my University that was abandoned by a previous employee. We are trying to simulate various events on our Campus and have several scenes that should take place in a specific order. I have modified the scripts left by the previous employee so that they work individually, but now I discover when combined, all scenes try start at once resulting in errors. The program is rather large and complex, so I have broken my code into object classes and various support modules that I won’t post here. Instead, I have written a pseudocode example of the problem I am having, namely that all functions run at once instead of in series as we intended (We are not using threads). Any help you can offer is greatly appreciated! Last edited by utepbereed; 11-21-2008 at 10:12 AM. Reason: About threads |
#2
|
|||
|
|||
I would highly recommend using the viztask module to control the flow of your program. Each stage would be implemented as a task and the main function would just yield each stage one after the other:
Code:
def stage1(): while SomeCondition: #Do something each frame here #Wait for next frame yield None def stage2(): while SomeCondition: #Do something each frame here #Wait for next frame yield None def main(): #Execute stage 1 and wait for it to finish yield stage1() #Execute stage 2 and wait for it to finish yield stage2() viztask.schedule(main()) |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
switching between scenes | david | Vizard | 4 | 07-01-2003 07:05 PM |