GUI:-please answer want to learn GUI programming in python , how should i proceed.

Steven D'Aprano steve at pearwood.info
Tue Dec 17 10:29:28 CET 2013


On Mon, 16 Dec 2013 23:58:15 -0800, wxjmfauth wrote:

> From all the toolkits, wxPython is probably the most interesting. I used
> all versions from 2.0 (?) up to 2.8. Then it has been decided to go
> unicode.
> 
> Let see in the wx interactive intepreter, it is only the top of the
> iceberg. (Py27, wxPy294)
> 
>>>> len('ሴЃ')
> 5


What does that have to do with wxPython? It looks like you're just mis-
using Python 2.7.

In Python 2.7, 'ሴЃ' is not a Unicode string, it is a byte string. The 
exact bytes you get are not well-defined but on many systems you may get 
a UTF-8 encoded byte string:


py> sys.version
'2.7.4 (default, Apr 18 2013, 17:48:59) \n[GCC 4.4.5]'
py> for b in 'ሴЃ':
...     print hex(ord(b)), b
... 
0xe1 
0x88 �
0xb4 �
0xd0 
0x83 �


If you use a Unicode string instead:

py> for c in u'ሴЃ':
...     print hex(ord(c)), c
... 
0x1234 ሴ
0x403 Ѓ

py> for b in u'ሴЃ'.encode('utf-8'):
...     print hex(ord(b)), b
... 
0xe1 
0x88 �
0xb4 �
0xd0 
0x83 �



Even if it is true that wxPython cannot handle Unicode text, you haven't 
shown it here.



-- 
Steven



More information about the Python-list mailing list