]> git.saurik.com Git - wxWidgets.git/blame - wxPython/tests/test_buttonKeyHandler.py
Tweaks needed to update to current CVS
[wxWidgets.git] / wxPython / tests / test_buttonKeyHandler.py
CommitLineData
cbfc9df6
RD
1import wx
2
3BIND_HANDLERS = False
4SKIP_EVENT = True
5
6def OnKeyDown(evt):
7 print "OnKeyDown", evt.KeyCode
8 if SKIP_EVENT:
9 evt.Skip()
10
11def OnKeyUp(evt):
12 print "OnKeyUp", evt.KeyCode
13 if SKIP_EVENT:
14 evt.Skip()
15
16def OnChar(evt):
17 print "OnChar", evt.KeyCode
18 if SKIP_EVENT:
19 evt.Skip()
20
21
22app = wx.App(False)
23frm = wx.Frame(None, title="test_buttonKeyHandler")
24pnl = wx.Panel(frm)
25
26btn = wx.Button(pnl, label="Focus me and press a key", pos=(20,20))
27if BIND_HANDLERS:
28 btn.Bind(wx.EVT_KEY_DOWN, OnKeyDown)
29 btn.Bind(wx.EVT_KEY_UP, OnKeyUp)
30 btn.Bind(wx.EVT_CHAR, OnChar)
31
32frm.Show()
33app.MainLoop()