Red Hat Bugzilla – Bug 110372
Python/Tkinter does not work because of Python - Tcl/Tk Unicode problem (UCS4 resp. UCS2)
Last modified: 2007-11-30 17:10:33 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)
Description of problem:
Tkinter (RPM packacke: tkinter) provides the Python bindings for Tk (a
GUI toolkit; 'Tcl/Tk'). But on Fedora Core 1, Python/Tk does not work
(i.e. you are not able to run any Python application using the Tk
The problem seems to be, that Python was compiled with the UCS4 option
for Fedora Core 1, whereas Tcl/Tk uses UCS2 (i.e. we have a Unicode
representation problem here).
One way to overcome this problem is to get the Python and Tkinter RPM
packages from www.python.org (same version as Python and Tkinter on
Fedora Core 1; i.e. at the moment *not* Python 2.3) and to update
Python and Tkinter on Fedora Core 1 with these packages (rpm -U ...).
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. install the python, tcl, tk, itcl, tix, tkinter RPM packages
2. try to run any Python/Tk application (e.g. 'python Tkinter.py')
I think, Tkinter should be installed automatically on any Fedora Core
System (which installs Python). Tkinter is the de facto standard GUI
for Python and many Python programmers rely on it being part of
Python. When installing Python from www.python.org, Tkinter is always
part of the Python distribution. (At the moment, it is 'hidden' on the
Fedora Core CD #3 and depends on some other packages - e.g. itcl, tix
- which have to be installed first.)
What exactly is the error you're seeing?
I can answer this because I see it too:
Python 2.2.3 (#1, Oct 15 2003, 23:33:35)
[GCC 3.3.1 20030930 (Red Hat Linux 3.3.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 3118, in _test
label = Label(root, text=text)
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 2285, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 1780, in __init__
SystemError: Py_UNICODE and Tcl_UniChar differ in size
$ rpm -q python
$ rpm -q tkinter
I've uploaded some 2.3.2 RPMs to the python.org site in the normal
locations for Fedora Core 1. These seem to run Idle ok, in a quick
test, so they may be worth trying. http://www.python.org/2.3.2/rpms.html
What is the status of this bug? I'm getting this error april 2004. I
have just installed fedora Core 1 and have installed all updates.
This has been fixed in Fedora Core 2 test 1, which ships Python 2.3.3
and tcl/tk 8.4
Sorry, this bug is still in NEEDINFO and didn't appear in my queries.
Sorry I didn't respond sooner: for a more immediate fix, I was able
to install the python 2.2.3-26 and tkinter 2.2.3-26 rpms from
http://www.python.org/2.2.3/rpms.html; while they are labeled as
being for RH9 they seem to work fine on FC1.