On Thu, 16 Sep 1999, Robin Dunn wrote:
> > As far as I can tell (from a quick look) a wxAcceleratorTable can only be
> > constructed from another wxAcceleratorTable. This isn't indicated in the
> > docs, and I can't see a way to add wxAcceleratorEntry's to one.
> >
> > Is there any way to do this?
> >
>
> It's supposed to be able to take a list of wxAcceleratorEntry objects, but I
> see that there is a little bug in recogizing the objects as being the right
> type. It's now fixed for the next release.
>
> As a work-around until then, there is an undocumented feature that you can
> also use a list of 3-tuples to make the wxAxcelleratorTable. The three
> values in each tuple are the flags, keyCode, and cmd, just like in the
> wxAcceleratorEntry constructor.
>
> --
> Robin Dunn
> Software Craftsman
>
[hidden email]
>
http://AllDunn.com/robin/>
http://AllDunn.com/wxPython/ Check it out!
>
So according to this last paragraph, I should be able to add the following
to the demo (in Main.py right after the creation of the File and Help
menus) to enable 'Ctrl-X' for 'exit' and 'Ctrl-H' for 'about'?:
self.SetAcceleratorTable([(wxACCEL_CTRL, 120, self.OnFileExit),
(wxACCEL_CTRL, 104, self.OnHelpAbout)])
On NT 4.0 with Python 1.5.2, wxWindows 2.1 r9, and wxPython 2.1 b3, I get:
D:\Python\wxPython\demo>python.exe demo.py
Traceback (innermost last):
File "demo.py", line 4, in ?
Main.main()
File "Main.py", line 285, in main
app = MyApp(0)
File "D:\Python\wxPython\wx.py", line 1447, in __init__
_wxStart(self.OnInit)
File "Main.py", line 277, in OnInit
frame = wxPythonDemo(NULL, -1, "wxPython: (A Demonstration)")
File "Main.py", line 87, in __init__
self.SetAcceleratorTable([(wxACCEL_CTRL, 120, self.OnFileExit),
File "D:\Python\wxPython\frames.py", line 59, in SetAcceleratorTable
val = apply(framesc.wxFrame_SetAcceleratorTable,(self,) + _args, _kwargs)
TypeError: Type error in argument 2 of wxFrame_SetAcceleratorTable. Expected _wx
AcceleratorTable_p.
D:\Python\wxPython\demo>
If this problem is fixed for the next release, could you please put a
sample (or two) of how to use it in the next version of the demo?
Thanx,
Bruce Rabine
_______________________________________________
wxPython-users maillist -
[hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users