Vizard 7 » Command Index » Vizard modules » viz » <viz:mouse>.getState


This command returns the current state of the mouse buttons

immediate = False  
immediate = False
If True, Vizard will immediately query the mouse instead of using the cached value.


Use this command at any time to check which mouse buttons are down.

Return Value

An integer which hold the state of the mouse buttons.


state = viz.mouse.getState()
if state & viz. MOUSEBUTTON_LEFT:
    print('left button down')
if state & viz. MOUSEBUTTON_RIGHT:
    print('right button down')
if state & viz. MOUSEBUTTON_MIDDLE:
    print('middle button down')