Here is some more information I neglected to include in my earlier post.
I'm running Python 2.4 everywhere (2.4.2 in win32) and wxPython 2.6.
I have tried adding EVT_CHAR handlers to individual buttons, again with no success. I read somewhere that the EVT_CHAR events wouldn't percolate up to the parent frame, but that is not what I am seeing - I'm having good luck (at least under Linux) catching the EVT_CHAR events at the dialog level.
Thanks in advance for the help!
Jim
James@Galbraith.name
jag@srv.net
···
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Do you mean something like:
So you get every key event, but if you
comment out the line with btn, no key event is
delivered to the dialog.
import wx
class MyDialog(wx.Dialog):
def __init__(self,parent):
wx.Dialog.__init__(self,parent,-1)
#btn = wx.Button(self, pos = (70, 100), label = "OK")
self.Bind(wx.EVT_CHAR, self.GetChar)
def GetChar(self, evt):
print evt.GetKeyCode()
evt.Skip()
class App(wx.App):
def OnInit(self):
frame = wx.Frame(None, pos = (400, 0))
d=MyDialog(None)
d.ShowModal()
d.Destroy()
frame.Show(True)
return True
app = App()
app.MainLoop()
···
On Mon, 21 Nov 2005 22:50:34 -0700, "James A. Galbraith" <jag@srv.net> wrote:
Here is some more information I neglected to include in my earlier post.
I'm running Python 2.4 everywhere (2.4.2 in win32) and wxPython 2.6.
I have tried adding EVT_CHAR handlers to individual buttons, again with no
success. I read somewhere that the EVT_CHAR events wouldn't percolate up
to the parent frame, but that is not what I am seeing - I'm having good
luck (at least under Linux) catching the EVT_CHAR events at the dialog
level.
Thanks in advance for the help!
Jim
James@Galbraith.name
jag@srv.net
--
Franz Steinhaeusler
Hi Franz,
The problem I am having is that with the button defined, I receive char
events under Linux, but not under Windows (with no changes to the code).
I am beginning to wonder if part of my problem is that I am using a
wxDialog instead of a wxFrame. Hmm....
Jim
James@Galbraith.name
···
On Mon, 21 Nov 2005 22:50:34 -0700, "James A. Galbraith" <jag@srv.net> > wrote:
Here is some more information I neglected to include in my earlier post.
I'm running Python 2.4 everywhere (2.4.2 in win32) and wxPython 2.6.
I have tried adding EVT_CHAR handlers to individual buttons, again with
no
success. I read somewhere that the EVT_CHAR events wouldn't percolate up
to the parent frame, but that is not what I am seeing - I'm having good
luck (at least under Linux) catching the EVT_CHAR events at the dialog
level.
Thanks in advance for the help!
Jim
James@Galbraith.name
jag@srv.net
Do you mean something like:
So you get every key event, but if you
comment out the line with btn, no key event is
delivered to the dialog.
import wx
class MyDialog(wx.Dialog):
def __init__(self,parent):
wx.Dialog.__init__(self,parent,-1)
#btn = wx.Button(self, pos = (70, 100), label = "OK")
self.Bind(wx.EVT_CHAR, self.GetChar)
def GetChar(self, evt):
print evt.GetKeyCode()
evt.Skip()
class App(wx.App):
def OnInit(self):
frame = wx.Frame(None, pos = (400, 0))
d=MyDialog(None)
d.ShowModal()
d.Destroy()
frame.Show(True)
return True
app = App()
app.MainLoop()
--
Franz Steinhaeusler