How to detect delete key EVT_KEY_DOWN on macbook without the simultaneous keydown of fn?

I care because there is no keycode name for the “delete” keydown event on my Macbook. However pressing both “fn” + “delete” corresponds to wx.WXK_DELETE keycode name.

I noticed on my Macbook that pressing just “delete” produces the code 8, so if I have an if statement like this:

self.fileOlv.Bind(wx.EVT_KEY_DOWN, self.doSomething)

def doSomething(self,evt):

if evt.GetKeyCode() == 8:

#do something

…and it turns out that on another type of Mac that pressing a key other than “delete” generates the keycode 8 and pressing “delete” does not generate the keycode 8 then the program would not behave the way a user would expect.

···

On Thursday, February 27, 2014 3:25:05 AM UTC-5, werner wrote:

Hi,

On 27/02/2014 09:16, RedHotChiliPepper wrote:

I noticed the numbers associated with keycodes differ from operating
systems.

http://www.wxpython.org/docs/api/wx.KeyEvent-class.html

For example on my Mac wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE are 127 and
385 respectively.

On Windows wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE are 13 and 370 respectively

Do the values associated with these variables vary only between
platform or also OS version and keyboard?

I don’t know but why do you care? As long as you use the keycode names
you are fine.

Werner