Hi List,
Included is a small sample where I have a (small?) problem.
This runs OK, however, when I press the Escape button, directly after
the program starts, nothing happens. After one click in the window, it
terminates the program as desired, but I have tried several things, but
it looks as though the event is not sent at all?
What am I doing wrong?
Thanks in advance,
Dick Kniep
···
-------------------------------------------------
#!/usr/bin/env python
from wxPython.wx import *
modules ={}
class test(wxApp):
def OnInit(self):
self.frm = wxFrame(NULL,-1,"testframe",(-1,-1),(-1,-1))
self.pnl = wxPanel(self.frm,-1)
txt = wxTextCtrl(self.pnl, -1,pos=(20,20))
txt.SetFocus()
EVT_CHAR(self.pnl,self.OnChar)
self.frm.Show(True)
return True
def OnChar(self,event):
if event.m_keyCode == WXK_ESCAPE:
self.canceled = True
self.frm.Close()
if __name__ == '__main__':
tstapp = test()
tstapp.MainLoop()