|
#1
|
|||
|
|||
Mouse and Viz.Input
Code:
viz.callback(viz.MOUSEDOWN_EVENT,onMouseDown) Thanks! |
#2
|
|||
|
|||
The viz.MOUSEDOWN_EVENT is only triggered when the mouse is clicked on the main graphics window. If you want to monitor mouse clicks that occur outside the main graphics window, you can create a timer that checks the immediate state of the mouse buttons. Here is some sample code:
Code:
lastState = 0 def CheckMouseDown(): global lastState state = viz.mouse.getState(True) if state & viz.MOUSEBUTTON_LEFT and not lastState & viz.MOUSEBUTTON_LEFT: print 'mouse down' lastState = state vizact.ontimer(0,CheckMouseDown) |
#3
|
|||
|
|||
izard 3.0 the mouse event does not seem to be fired when I'm on a slider
In Vizard 3.0 the mouse event does not seem to be fired when I'm on a slider.
I want that after changing the slider (MouseUp_event) some objects are reset. Best, Johannes |
#4
|
|||
|
|||
Hi,
If you want to know when a slider is released, then handle the viz.BUTTON_EVENT and check for the slider object. Example: Code:
import viz viz.go() slider = viz.addSlider(pos=(0.5,0.1,0)) def onButton(obj,state): if obj == slider and state == viz.UP: print 'slider released' viz.callback(viz.BUTTON_EVENT,onButton) Code:
import viz viz.go() slider = viz.addSlider(pos=(0.5,0.1,0)) def onMouseUp(button): if button == viz.MOUSEBUTTON_LEFT: print 'left button released' viz.callback(viz.MOUSEUP_EVENT,onMouseUp,priority=viz.PRIORITY_GUI_HANDLER-1) |
#5
|
|||
|
|||
Thank you!!
Thank you, it worked!
|
Thread Tools | |
Display Modes | Rate This Thread |
|
|