I tried. It can't work.
print frame.AcceptsFocus(), panel.AcceptsFocus()
get output: False False
And in fact, wx.WANTS_CHARS can work if set an object derived from wx.Window in a panel and do SetFocus(). Just as demo did.
Got other methods?
···
zoro wrote:
>I'd like to make a frame to process all key event before widgets in it get the event.
>
>How to make it happen?I am totally newbie.
>
>I set the wx.WANTS_CHARS style. But it did not work.
>
>here's the code:
>
>class myframe(wx.Frame):
> def __init__(self, parent, title):
> wx.Frame.__init__(self, parent, -1, title, style=wx.DEFAULT_FRAME_STYLE | wx.WANTS_CHARS)
> self.Bind(wx.EVT_CHAR, self.onchar )
> def onchar( self, evt )
> print evt.KeyCode()
>
Try catching the events from a panel in the frame instead
And make sure it has the focus - panel.SetFocus()David
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
----------------------------------------------
���ֻ�������ͬ����ͼƬ������������
http://sms.21cn.com/tlby/
��ӹ�����л��������� �÷���ҪЮ
http://news.21cn.com/social/
2Ԫ/�죬��ҵ����һ���ĵã�Ӯȡmp3���������
���������,8�۹�������