Hello
I’m trying to run a simple Hotkey Register script on my freshly installed Arch Linux (+openbox). The code must be ok because it works on Windows XP, but it fails miserably on this distro/window manager.
The code is the following:
#! /usr/bin/python
import wx
import sys
class HotkeyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "", size = (1, 1),
style=wx.FRAME_NO_TASKBAR|wx.NO_FULL_REPAINT_ON_RESIZE)
self.Show(True)
def AddHotkey(self, key, mod, function):
hotkey_id = wx.NewId()
self.RegisterHotKey(hotkey_id, mod, key)
self.Bind(wx.EVT_HOTKEY, function, id=hotkey_id)
def CreateApp():
app = wx.App()
frame = HotkeyFrame()
app.MainLoop()
if name == ‘main’:
print ‘The test hotkey is: ALT + SPACE’
def Test(event=None):
print “Hello!”
CreateApp()
frame.AddHotkey(32, 2, Test)
A tiny frame is created, the “The test hotkey is” message is printed, there are no errors… But nothing happens when I press the key combination.
Where is the problem? Python/wxPython build, script, distro, Openbox or the lack of a proper Desktop Environment?