Background info:
···
-------------------------
I have Python/wxPython an application that is internationalized using the
gettext system and that has the ability to change the natural language
dynamically (from user selected option menu). All works fine. The application
currently supports English and French. The user can flip from English to French
and the text changes on every item. There is no limit to the number of time you
can flip the presentation language.
Problem:
-------------
I noticed, however, that the application crashes after 4 flip if one of the menu
has a label with a keyboard shortcut.
The following line works fine:
self.mnuFile.SetLabel(wxID_WXFRAME1MNUFILEMNU_EXIT,_(u'Exit'))
#with the translation being: "Quitte"
The following line also works fine:
self.mnuFile.SetLabel(wxID_WXFRAME1MNUFILEMNU_EXIT,_(u'E&xit\tCtrl-X'))
#with the translation being: "&Quitte\tCtrl-Q"
The following line also works fine:
self.mnuFile.SetLabel(wxID_WXFRAME1MNUFILEMNU_EXIT,_(u'E&xit'))
#with the translation being: "&Quitte"
**But** this line make the program crash on the 5th language flip:
self.mnuFile.SetLabel(wxID_WXFRAME1MNUFILEMNU_EXIT,_(u'E&xit\tCtrl-X'))
#with the translation being: "&Quitte\tCtrl-X"
Note that Ctrl-X and Ctrl-Q are not clashing with any other shortcut inside the
program (in either language).
Also note that the first 4 flips work fine.
The program crashes on the 5th flip
The program crashes inside Python.exe, with the note:
'The instruction "0x009f4383" referenced memort at "0x00000027". The
memory could not be "read".'
My System:
-----------------
Windows NT SP6
Python 2.2
wxPython 2.4.0.7u
Questions:
--------------
- Is this a known limitation/bug?
- What is the best way to hunt bugs like this when using wxPython?
- What are the constraints when setting keyboard shortcuts with
wxMenu.SetLabel()?
- Is it allowed to use two different letters for menu/keyboard shorcuts as in
"&Quitte\tCtrl-X" ? (irrespective to the way that it should be
"&Quitte\tCtrl-Q")
- When re-setting the labels of all menus, there is a possibility that for a
period of time two menus are assigned with the same shortcut. Is this allowed?
Thanks for the help.
--
Pierre Rouleau