python怎么在linux系统下设置热键
python怎么在linux系统下设置热键,比如像QQ那样,按下Ctrl+Alt+Z就可以弹出QQ窗口,并且可以在python程序中捕获到这个键盘事件[wxPython]键盘事件
程序代码:
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()
[ 本帖最后由 外部三电铃 于 2010-3-23 17:46 编辑 ]