Subject: bug#20889: python Tkinter

From: [email-masked] (Ludovic Courtès)
Date: Wed, 11 Nov 2015 22:44:42 +0100

Federico Beffa <[email-masked]> skribis:

> >>> root = tkinter.Tk()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/gnu/store/y5x6c38fzrbfl80jxrgjd6py2k88x12a-python-3.4.3/lib/python3.4/tkinter/__init__.py",
> line 1851, in __init__
>     self.tk = _tkinter.create(screenName, baseName, className,
> interactive, wantobjects, useTk, sync, use)
> _tkinter.TclError: Can't find a usable tk.tcl in the following directories:
>     /gnu/store/sd4fcdk9yzh1s0230fjx1yfwk9pl71bf-tcl-8.6.4/lib/tcl8.6/tk8.6
> /gnu/store/sd4fcdk9yzh1s0230fjx1yfwk9pl71bf-tcl-8.6.4/lib/tk8.6
> /gnu/store/y5x6c38fzrbfl80jxrgjd6py2k88x12a-python-3.4.3/lib/tk8.6
> /gnu/store/lib/tk8.6
> /gnu/store/y5x6c38fzrbfl80jxrgjd6py2k88x12a-python-3.4.3/library

This error message comes from Tcl, in file ‘auto.tcl’, procedure
‘tcl_findLibrary’.

We’d need to find where the call comes from and hard-code a search path
in there maybe?

> Did you successfully test it?

I just did “import tkinter.”

> with:
>
> $TCLLIBPATH=/gnu/store/c4rpx4050d0qkccwbzggabag403b31l3-tk-8.6.4/lib python3
>
> it works. So I guess that 'tcl' needs a search-path-specification.

Yes.  That wouldn’t help for Python though, where we need to hard-code
the search path somehow.

> ... and the configure script for Python defines the flag
> '--with-tcltk-libs'. Maybe that would help...

I don’t think it would help because Python finds Tcl and Tk anyway.

Thanks,
Ludo’.