building Python with Tkinter

Kragen Sitaker kragen at dnaco.net
Thu Mar 9 13:11:45 EST 2000


I've been playing with Python for a while at home; I decided to
install 1.5.2 at work, where we have Solaris 7.

I'd like to play with Tkinter.  After building it the first time, I
discovered that I had built it without Tk support (from Tkinter import
*; Button().pack() explained this to me.)  

So I read README and edited Modules/Setup.  The Tkinter section of my
Modules/Setup is as follows:

# *** Always uncomment this (leave the leading underscore in!):
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
        -I/var/tk/v8.0p2/include -I/var/tcl/v8.0p2/include \
# *** Uncomment and edit to reflect where your X11 header files are:
#       -I/usr/X11R6/include \
# *** Or uncomment this for Solaris:
        -I/usr/openwin/include \
# *** Uncomment and edit for Tix extension only:
#       -DWITH_TIX -ltix4.1.8.0 \
# *** Uncomment and edit for BLT extension only:
#       -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
# *** Uncomment and edit for PIL (TkImaging) extension only:
#       -DWITH_PIL -I../Extensions/Imaging/libImaging  tkImaging.c \
# *** Uncomment and edit for TOGL extension only:
#       -DWITH_TOGL togl.c \
# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
        -L/var/tk/v8.0p2/lib -L/var/tcl/v8.0p2/lib \
# *** Uncomment and edit to reflect your Tcl/Tk versions:
        -ltk8.0 -ltcl8.0 \
# *** Uncomment and edit to reflect where your X11 libraries are:
#       -L/usr/X11R6/lib \
# *** Or uncomment this for Solaris:
        -L/usr/openwin/lib \
# *** Uncomment these for TOGL extension only:
#       -lGL -lGLU -lXext -lXmu \
# *** Uncomment for AIX:
#       -lld \
# *** Always uncomment this; X11 libraries to link with:
        -lX11

The compile and link went successfully, but python -c 'from Tkinter
import *; Button().pack()' gives the following traceback:

Traceback (innermost last):
  File "<string>", line 1, in ?
  File "/var/u/sittler/lib/python1.5/lib-tk/Tkinter.py", line 1123, in __init__
    Widget.__init__(self, master, 'button', cnf, kw)
  File "/var/u/sittler/lib/python1.5/lib-tk/Tkinter.py", line 1078, in __init__
    BaseWidget._setup(self, master, cnf)
  File "/var/u/sittler/lib/python1.5/lib-tk/Tkinter.py", line 1055, in _setup
    _default_root = Tk()
  File "/var/u/sittler/lib/python1.5/lib-tk/Tkinter.py", line 886, in __init__
    self.tk = _tkinter.create(screenName, baseName, className)
TclError: Can't find a usable init.tcl in the following directories: 
    /usr/local/lib/tcl8.0 ./lib/tcl8.0 ./tcl8.0/library ./library



This probably means that Tcl wasn't installed properly.

Now, tclsh8.0 and wish8.0 from /var/tk/v8.0p2/bin and
/var/tcl/v8.0p2/bin work fine (albeit quite slowly due to running from
NFS over a fractional T1).

gdb tells me Tcl_AppInit in tkappinit.c is calling Tcl_Init, which is
returning TCL_ERROR.  Tcl_Init is defined in tclUnixInit.c inside of
libtcl.

Is there anything I can do, other than building my own libtcl?  Do I
need to rebuild libtk too?
-- 
<kragen at pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
The power didn't go out on 2000-01-01 either.  :)



More information about the Python-list mailing list