Mailing List Archive

Python tkinter with Tcl/Tk 8.1?
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
Python tkinter with Tcl/Tk 8.1? [ In reply to ]
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

Thats interesting. I've also had problems with tcl/tk 8.1. trying to
load
any tcl/tk apps results in errors. for example:

scratchy:/usr/local/src/Python-1.5.2/Demo/tkinter/guido$ python hello.py
Traceback (innermost last):
File "hello.py", line 17, in ?
main()
File "hello.py", line 7, in main
root = Tk()
File "/usr/local/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:




This probably means that Tcl wasn't installed properly.

scratchy:/usr/local/src/Python-1.5.2/Demo/tkinter/guido$

I'm not an X person, most of the time I'm in the console, but i'm the
kind
of guy that likes to have everything working even if i dont need it. :-)
anyone know that the heck is going on?
Python tkinter with Tcl/Tk 8.1? [ In reply to ]
In article <37B265D2.8A5C962A@sprint.ca>, Orlando Vazquez
<ovazquez@sprint.ca> writes
>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
>
>Thats interesting. I've also had problems with tcl/tk 8.1. trying to
>load
>any tcl/tk apps results in errors. for example:
>
>scratchy:/usr/local/src/Python-1.5.2/Demo/tkinter/guido$ python hello.py
>Traceback (innermost last):
> File "hello.py", line 17, in ?
> main()
> File "hello.py", line 7, in main
> root = Tk()
> File "/usr/local/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:
>
>
>
>
>This probably means that Tcl wasn't installed properly.
>
>scratchy:/usr/local/src/Python-1.5.2/Demo/tkinter/guido$
>
>I'm not an X person, most of the time I'm in the console, but i'm the
>kind
>of guy that likes to have everything working even if i dont need it. :-)
>anyone know that the heck is going on?
8.1 is very different internally from 8.0.5. Its has unicode support and
something called a stubs linker for extensions so maybe the tkinter
connection is a bit broken. Does wish8.0 work?
--
Robin Becker
Python tkinter with Tcl/Tk 8.1? [ In reply to ]
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