button problems
Hi-
I'm working with GUIs and I have a problem when I add both a textbox and a button. When I run the script below, I click on the textbox and, as expected, that triggers an event. The weird thing is, when I click on the button, it triggers another event for the textbox (<viz.VizTextbox object at 0x01FFF6F0>). It's not until the second time I click the button that I get an event for the button (<viz.VizCheckBox object at 0x01FFFE50>).
button = viz.addButton()
button.translate( .5, .5 )
text = viz.addTextbox()
text.translate( .5, .8 )
def onButton(obj,state):
print obj
if obj == button:
print 'now accepting buttons'
viz.callback(viz.BUTTON_EVENT,onButton)
|