Vizard 8 » Command Index » Vizard modules » viztask » <viztask>.waitTask
8.0

<viztask>.waitTask

Wait for the specified task to end

<viztask>.waitTask(  
gen  
)  
gen
A generator object to run as a task

Remarks

This command will create a Condition object that will wait for the specified task to finish. This command is usually unnecessary because you can yield a task by itself. This is useful when you want to wait for a task using the viztask.waitAny/waitAll conditions.

Return Value

viztask.Condition object

Example

import viztask

def subTask():
    for x in range(120):
        print(viz.getFrameNumber())
        yield None

def WaitTask():
    while True:
        yield viztask.waitKeyDown(' ')
        yield viztask.waitAny( [viztask.waitKeyDown(' '),viztask.waitTask(subTask())] )
        print('Finished subtask')

viztask.schedule( WaitTask() )