How can I display unicode in Tk widget

Kirill Simonov kirill at xyz.donetsk.ua
Tue Dec 18 11:48:09 EST 2001


On Tue, Dec 18, 2001 at 12:19:58PM +0100, Martin von Loewis wrote:
> On Windows, Tcl doesn't find its encoding database, thus it cannot
> find out how to convert the Unicode string for display. Setting
> TCL_LIBRARY may help.
> 
> It is questionable whether this is a bug in Tcl or Python: It is a bug
> in Python, for not installing Tcl libraries in a place where Tcl will
> find them, and it is a bug in Tcl, for not offering an API to tell it
> a different location for the codecs database.

This is a bug in "Python2*/Lib/lib-tk/FixTk.py".
Here is the right way to set TCL_LIBRARY.

FixTk.py
========

# Do not import _tkinter!
import sys, os

if not os.environ.has_key('TCL_LIBRARY'):
    # Tcl is smart enough to check "$TCL_LIBRARY/tclX.Y/../tcl8.3/".
    tcl_library = os.path.join(sys.prefix, "tcl", "tclX.Y")
    os.environ['TCL_LIBRARY'] = tcl_library

========


Kirill.





More information about the Python-list mailing list