cross platform event problem

Try binding the event directly to the event generator, the textctrl.

I think your problem might be cause by the fact that wx.KeyEvent is not a wx.CommandEvent and it doesn’t propagate in the hierarchy of controls.

Peter

···

On Wed, Apr 23, 2008 at 3:41 PM, Phillip Watts phillip.watts@anvilcom.com wrote:

I spent a month developing this app on Kubuntu. Looks great,

lots of use of function keys, navigates a ListCtrl.

Copied it to WinXP, loaded latest wxpython and Python25.

Screen colors look strange, spacing is off, but worst:

no response to function keys or enter key events.

and tab just puts a funny char in the textctrl.

Should I be doing something different for win32 keyboard?

I did the following simple app to illustrate.

On Kubuntu, EVT_KEY_DOWN works, processkey() executes

and prints the keycode.

But not on WinXP.

#!/usr/bin/env python

-- coding: UTF-8 --

generated by wxGlade 0.4.1 on Tue Apr 22 15:35:58 2008

import wx

class MyFrame(wx.Frame):

def __init__(self, *args, **kwds):

    print 'init'

    # begin wxGlade: MyFrame.__init__

    kwds["style"] = wx.DEFAULT_FRAME_STYLE

    wx.Frame.__init__(self, *args, **kwds)

    self.text_ctrl_1 = wx.TextCtrl(self, -1, "")



    self.__set_properties()

    self.__do_layout()

    # end wxGlade



def __set_properties(self):

    # begin wxGlade: MyFrame.__set_properties

    self.SetTitle("frame_1")

    self.SetFocus()

    # end wxGlade



def __do_layout(self):

    # begin wxGlade: MyFrame.__do_layout

    sizer_1 = wx.BoxSizer(wx.VERTICAL)

    sizer_1.Add(self.text_ctrl_1, 0, wx.ADJUST_MINSIZE, 0)

    self.SetAutoLayout(True)

    self.SetSizer(sizer_1)

    sizer_1.Fit(self)

    sizer_1.SetSizeHints(self)

    self.Layout()

    # end wxGlade

end of class MyFrame

def processkey(event):

    print 'processkey'

    k = event.GetKeyCode()

    print k

app = wx.App()

f = MyFrame(None,-1)

f.Bind(wx.EVT_KEY_DOWN,processkey)

f.Show()

app.MainLoop()


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users


There is NO FATE, we are the creators.