Created
August 31, 2015 14:06
-
-
Save anaselli/807a84de3e1ee08b47d2 to your computer and use it in GitHub Desktop.
YItem comparison in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import yui | |
factory = yui.YUI.widgetFactory() | |
dialog = factory.createMainDialog() | |
VBox = factory.createVBox(dialog) | |
mySelMinSize = factory.createMinSize(VBox, 50, 12) | |
mySel = factory.createSelectionBox(mySelMinSize, "Selection Box") | |
mySel.setNotify(True); | |
myOK = factory.createPushButton(VBox, "OK") | |
myItem = yui.YItem( "foo" ) | |
mySel.addItem(myItem) | |
myItem2 = yui.YItem( "bar" ) | |
mySel.addItem(myItem2) | |
while True: | |
event = dialog.waitForEvent() | |
if event.eventType() == yui.YEvent.CancelEvent: | |
break | |
if event.widget() == myOK: | |
break | |
if event.widget() == mySel: | |
item = mySel.selectedItem(); | |
if item == myItem: | |
print "item comparison works and you chose", item.label() | |
elif item == myItem2: | |
print "item comparison works and you chose", item.label() | |
else: | |
print "item comparison does not work" | |
dialog.destroy() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment