Is it possible to capture the user hitting the 'Enter' key when focus is on the wxChoice widget?
Any advice would be greatly appreciated.
from wxPython.wx import *
···
#---------------------------------------------------------------------------
class TestChoice(wxPanel):
def __init__(self, parent, log):
#self.log = log
wxPanel.__init__(self, parent, -1)
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
'six', 'seven', 'eight']
wxStaticText(self, -1, "Select one:", wxPoint(15, 50), wxSize(75, 20))
self.ch = wxChoice(self, 40, (80, 50), choices = sampleList,style=wxTE_PROCESS_ENTER)
self.ch2 = wxChoice(self, 41, (80, 80), choices = sampleList)
#EVT_TEXT_ENTER(self, 40, self.EvtChange)
#EVT_TEXT_ENTER(self, 41, self.EvtChange)
EVT_CHOICE(self, 40, self.EvtChoice)
EVT_CHOICE(self, 41, self.EvtChoice)
#EVT_TEXT(self, 40, self.EvtChange)
#EVT_TEXT(self, 41, self.EvtChange)
def EvtChoice(self, event):
print 'in EvtChoice'
event.Skip()
def EvtEnter(self, event):
print 'in EvtEnter'
def EvtChange(self, event):
print 'in EvtChange'
if __name__ == '__main__':
app = wxPySimpleApp()
frame = wxFrame(None, -1, "The Title")
nb = TestChoice(frame, None)
frame.Show(true)
app.MainLoop()