import wx
class KeyEvent(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title)
panel = wx.Panel(self, -1)
panel.Bind(wx.EVT_CHAR, self.OnKeyDown)
panel.SetFocus()
self.Centre()
self.Show(True)
def OnKeyDown(self, event):
if event.GetKeyCode() == ord('f'):
if self.GetPosition()==((0,0)):
self.SetPosition((300,300))
self.SetSize((500,300))
else:
self.SetPosition((0,0))
self.SetSize(wx.DisplaySize())
if event.GetKeyCode() == ord('q'):
self.Close()
else:
event.Skip()
app = wx.App()
KeyEvent(None, -1, 'k.py')
app.MainLoop()
阅读(3819) | 评论(0) | 转发(0) |