Vizard 7 » Command Index » Vizard modules » viztask » <viztask>.waitMouseDown
7.6

<viztask>.waitMouseDown

Wait for a specified mouse button press

<viztask>.waitMouseDown(  
button  
)  
button
The mouse button to wait for.

If button is None, then the Condition will wait for any mouse button to be pressed.

Remarks

This command will create a Condition object that will wait for one of the specified mouse buttons to be pressed.

The yielded command returns a viz.Data object with the following information about the condition:

Properties

button

The mouse button that was pressed

time

The precise time of the mouse button press

Return Value

viztask.Condition object

Example

Example 1
import viztask

def MyTask():

    while True:

        yield viztask.waitMouseDown(viz.MOUSEBUTTON_LEFT)

        print('Left mouse button pressed')

viztask.schedule( MyTask() )

Example 2
import viztask

def MyTask():

    while True:

        d = yield viztask.waitMouseDown(None)

        print('Mouse button',d.button,'was pressed at time',d.time)

viztask.schedule( MyTask() )