Petter Holt Juliussen • Mail | Mastodon | GitHub | Letterboxd

for later reference.

wxPython

2019-04-04

Hotkeys

# Hotkey: CTRL + SHIFT + F12
self.RegisterHotKey(1001, win32con.MOD_CONTROL|win32con.MOD_SHIFT, win32con.VK_F12)
self.Bind(wx.EVT_HOTKEY, self.on_hotkey, id=1001)

# Hotkey: CTRL + ALT + P
self.RegisterHotKey(1002, win32con.MOD_CONTROL|win32con.MOD_ALT, ord('P'))
self.Bind(wx.EVT_HOTKEY, self.on_hotkey, id=1002)

# Key state
print wx.GetKeyState(ord('h')) # Prints true if the 'h' key is currently pressed

  1. RegisterHotKey 

  2. GetKeyState