Re: evt.GetUnicodeKey returns int instead of string
Robin Dunn <[email protected]>
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
Werner wrote: > There is an issue in ObjectListView where a user sees this exception: > > File "D:\devOther\samplesTest\olvQuestions\user32typeerror.py", line > 111, in <module> > main() > File "D:\devOther\samplesTest\olvQuestions\user32typeerror.py", line > 108, in main > app.MainLoop() > File "c:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", > line 8010, in MainLoop > wx.PyApp.MainLoop(self) > File "c:\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", > line 7306, in MainLoop > return _core_.PyApp_MainLoop(*args, **kwargs) > File "c:\Python27\Lib\site-packages\ObjectListView\ObjectListView.py", > line 1410, in _HandleChar > if self._HandleTypingEvent(evt): > File "c:\Python27\Lib\site-packages\ObjectListView\ObjectListView.py", > line 1457, in _HandleTypingEvent > if uniChar not in string.printable: > > TypeError: 'in <string>' requires string as left operand, not int > > When I set a breakpoint and then check the value I see this (I pressed > "3"). > chr(evt.GetKeyCode()) > '3' > evt.GetUnicodeKey() > 51 > > Phoenix documentation states that GetUnicodeKey should return a string. Actually, the documentation is incorrect. The C++ GetUnicodeKey returns a wxChar value, which is a typedef for an integer type of whatever size is appropriate for single unicode values on the platform. The mistake in the documentation is probably because the sphinx generator is assuming that wxChar is the same as wxChar*, which is a pointer to a buffer of wxChar values, which would usually be thought of as a string-like thing. So the fix would be to track down where that is happening and change it to treat non-pointer wxChars as int. -- Robin Dunn Software Craftsman http://wxPython.org -- You received this message because you are subscribed to the Google Groups "wxPython-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.