Python tkinter with Tcl/Tk 8.1?

Pascal Nelson Pascal.Nelson at analog.com
Fri Aug 13 13:42:10 EDT 1999


foo wrote:
> 
> I could not find any documentation on this in the FAQ or the tkinter pages,
> so I am asking here. I have had to move to Tcl/Tk 8.1 for another software
> package I am using on my computer. I have rebuilt Python 1.5.2 after getting
> the new Tcl/Tk installed and (no great surprise) tkinter does not seem to
> work (I can successfully import Tkinter from the python command line, but
> attempting to run Tkinter._test() crashes python due to access violations
> (reading wild pointers).
> 
> Is it possible to build the tkinter module successfully with Tcl/Tk 8.1?
> 
> Thanks,
> Jonathan

I just experienced the same problem a couple of days ago trying to get
Python 1.52 and TCL/TK 8.1.1 working on a Sun running Solaris. I found
out that there is are two very simple patches that need to be applied to
the source of _tkinter.c and tkappinit.c. These patches were posted a
few months ago by Dieter Maurer to the python mailing list. Archives of
the mailing list can be found at
http://www.python.org/pipermail/python-list/

Just to make it easier, here are the patches:

############################################

--- :_tkinter.c Mon Jan 25 22:39:03 1999
+++ _tkinter.c  Fri May 28 21:18:16 1999
@@ -491,6 +491,10 @@
 
        v->interp = Tcl_CreateInterp();
 
+#if    TKMAJORMINOR >= 8001
+       TclpInitLibraryPath(baseName);
+#      endif /* TKMAJORMINOR */
+
 #if defined(macintosh) && TKMAJORMINOR >= 8000
        /* This seems to be needed since Tk 8.0 */
        ClearMenuBar();

############################################

############################################

--- :tkappinit.c        Tue Dec  2 21:38:38 1997
+++ tkappinit.c Tue Jun  1 21:11:25 1999
@@ -21,12 +21,12 @@
 {
        Tk_Window main;
 
-       main = Tk_MainWindow(interp);
-
        if (Tcl_Init (interp) == TCL_ERROR)
                return TCL_ERROR;
        if (Tk_Init (interp) == TCL_ERROR)
                return TCL_ERROR;
+
+       main = Tk_MainWindow(interp);
 
 #ifdef WITH_MOREBUTTONS
        {
############################################

I applied these patches, and it fixed the problem.

Good luck.

Pascal


-- 
Pascal Nelson
Analog Devices Inc.
Greensboro NC




More information about the Python-list mailing list