WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   question about BUTTON_EVENT (https://forum.worldviz.com/showthread.php?t=5769)

haohaoxuexi1 06-29-2016 06:20 AM

question about BUTTON_EVENT
 
checkbox = viz.addCheckbox(pos=(0.5,0.5,0))

def onButton(obj,state):
if obj == checkbox:
if state == viz.DOWN:
print 'Checked'
else:
pass

viz.callback(viz.BUTTON_EVENT,onButton)

checkbox2 = viz.addCheckbox(pos=(0.5,0.5,0))

def onButton1(obj,state):
if obj == checkbox2:
if state == viz.DOWN:
print 'Checked'
else:
pass

viz.callback(viz.BUTTON_EVENT,onButton1)


when i write the code as above, why is the system only execute the later BUTTON_EVENT but not both of them?

If i have two checkbox, should i put the judging condition in the same function?

Jeff 06-29-2016 09:20 AM

I think this is expected behavior when two buttons are stacked on top of each other. What is the reason for having two buttons in the same position?

You could use the vizact.onbuttondown command and register a callback function for each button.


All times are GMT -7. The time now is 11:29 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC