RegisterHotKey

Hello,

When wx.EVT_HOTKEY(self.HotKeyPost, 1)

I get:

assert len(args) == 2 + self.expectedIDs

AssertionError

My Code:

self.RegisterHotKey(1, modifier, keycode)
self.RegisterHotKey(2, modifier, keycode)

wx.EVT_HOTKEY(self.HotKeyPost, 1)
wx.EVT_HOTKEY(self.HotKeyRepeat, 2)

def HotKeyPost(self, event):
     self.somefunction()

def HotKeyRepeat(self, event):
     self.someotherfunction()

How do I register hotkeys? With examples preferably :^)

Thanks,

Keith

wx 2.5.1.5

Keith,

Hotkey support is known to be broken in wx 2.5.1.5 Try the newer version.

   Vladimir Ignatov

···

----- Original Message -----
From: "Keith Bolton" <Keith.Bolton@batescapital.com>
To: <wxPython-users@lists.wxwidgets.org>
Sent: Saturday, October 16, 2004 12:32 AM
Subject: [wxPython-users] RegisterHotKey

Hello,

When wx.EVT_HOTKEY(self.HotKeyPost, 1)

I get:

assert len(args) == 2 + self.expectedIDs

AssertionError

My Code:

self.RegisterHotKey(1, modifier, keycode)
self.RegisterHotKey(2, modifier, keycode)

wx.EVT_HOTKEY(self.HotKeyPost, 1)
wx.EVT_HOTKEY(self.HotKeyRepeat, 2)

def HotKeyPost(self, event):
     self.somefunction()

def HotKeyRepeat(self, event):
     self.someotherfunction()

How do I register hotkeys? With examples preferably :^)

Thanks,

Keith

wx 2.5.1.5

Keith Bolton wrote:

wx.EVT_HOTKEY(self.HotKeyPost, 1)
wx.EVT_HOTKEY(self.HotKeyRepeat, 2)

You need to tell it which object to bind the event handler to, so something like this:

  wx.EVT_HOTKEY(self, 1, self.HotKeyPost)

or the new way:

  self.Bind(wx.EVT_HOTKEY, self.HostKeyPost, id=1)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!