Tkinter-Listbox and Unicode
Martin von Loewis
loewis at informatik.hu-berlin.de
Thu Jan 24 09:40:23 EST 2002
Matthias Huening <mhuening at zedat.fu-berlin.de> writes:
> > might work - although this fails if one of the strings contains a
> > space in itself
>
> Most of them contain spaces in itself...
>
> Seems that the combination Python/Tkinter/Unicode is near useless for my
> purpose.
I would not say that. For the few function calls that do use
splitlist, you can apply another work-around:
def uni_splitlist(tk, message):
try:
return tk.splitlist(message)
except UnicodeError:
result = tk.splitlist(message.encode('utf-8'))
return [unicode(part,'utf-8') for part in result]
This does splitlist via UTF-8; it should work safely in all cases.
> What about the Unicode-support of other GUIs?
I think it is pretty weak. E.g. for Gtk, only Gtk 2.0 will support
Unicode throughout, and I don't know whether PyGtk has even cauhgt up.
PythonWin will work pretty well; Mark Hammond has spent much effort
into providing Unicode-safe APIs.
Regards,
Martin
More information about the Python-list
mailing list