Last active
August 11, 2016 20:10
-
-
Save driscollis/4e13762e22d01a9a2ee5b6d659b9547d to your computer and use it in GitHub Desktop.
Combo event example
This file contains hidden or 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 wx | |
| ######################################################################## | |
| class MyFrame(wx.Frame): | |
| """""" | |
| #---------------------------------------------------------------------- | |
| def __init__(self): | |
| """Constructor""" | |
| wx.Frame.__init__(self, None, title='combo') | |
| panel = wx.Panel(self) | |
| choices = ['cat', 'dog', 'pig'] | |
| cbo = wx.ComboBox(panel, choices=choices) | |
| cbo.Bind(wx.EVT_TEXT, self.onTextChange) | |
| cbo.Bind(wx.EVT_COMBOBOX, self.onComboChange) | |
| cbo.SetValue('random') | |
| self.Show() | |
| #---------------------------------------------------------------------- | |
| def onTextChange(self, event): | |
| """""" | |
| print 'text changed' | |
| #---------------------------------------------------------------------- | |
| def onComboChange(self, event): | |
| """""" | |
| print 'combo changed' | |
| if __name__ == '__main__': | |
| app = wx.App(True) | |
| frame = MyFrame() | |
| app.MainLoop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OK, seems like my issue is only when
styleincludeswx.CB_READONLY.This code only prints 0, not 1: