[extensions-plugins, Windows, MSys2]: Usage of Tkinter fails

Bug #1735451 reported by Jan Winkler
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fix Released
Patrick Storz

Bug Description

I am one of the developers of TexText, a plugin enabling the user to put LaTeX rendered input as svg nodes into the document. Under Inkscape 0.92.2, Windows 7 (64-bit) the instantiation of Tk-objects fails in the provided Python distribution of Inkscape.

Steps to reproduce:
1. Change into the installation directory of Inkscape (e.g. c:\Program Files\Inkscape\)
2. Open a command prompt and start the Python interpreter
3. Enter
   import Tkinter as tk
4. Enter
   root = tk.Tk()

The last step results in the following message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Program Files\Inkscape\lib\python2.7\lib-tk/Tkinter.py", line 1820, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
    {c:/Program Files/lib/tcl8.6} {c:/Program Files/lib/tcl8.6} c:/lib/tcl8.6 {c:/Program Files/library} c:/library c:/tcl8.6.6/library c:/tcl8.6.6/library

This probably means that Tcl wasn't installed properly.les\Inkscape\

I do not find an init.tcl anywhere (although tcl86.dll and tk86.dll are available in the provided Inkscape-python distribution) and I am wondering about the listed paths. Does anyone of the Windows binary packagers has an idea how to fix this issue?

Jan Winkler (jcwinkler)
description: updated
description: updated
Revision history for this message
Patrick Storz (ede123) wrote :

Thanks for getting back to us!

The cause of this issue is twofold:
- We're missing some files in share/{tcl,tcl8.6,tk}
  in our final distribution of Inkscape
- tcl relocation is broken so even with those files in place it will
  search for them in the wrong places (see paths in your traceback)

The fix I submitted upstream to fix the second issue was merged just yesterday:

With relocation fixed we only need to update our packaging (I'll push a fix for this shortly).

Locally I was already able to use tkinter with these changes.

Changed in inkscape:
status: New → In Progress
assignee: nobody → Eduard Braun (eduard-braun2)
Revision history for this message
Patrick Storz (ede123) wrote :

Added missing files to the distribution in master
and 0.92.x

Tkinter should be working properly now in combination with the updated tcl package from upstream.

Changed in inkscape:
milestone: none → 0.92.3
status: In Progress → Fix Committed
Revision history for this message
Jan Winkler (jcwinkler) wrote :

Thank you very much! I manually added the freshly built tcl and tk packages from http://repo.msys2.org/mingw/x86_64/ and now TexText works flawlessly again.

I was also able to add the glib, object2, pygtk and pycairo packages the same way, so the gtk-version of TexText (which we prefer due to available syntax highlighting) works as well.

One open question: In BOTH cases I had to manually add the path to the subdir "bin":

os.environ["PATH"] = 'C:\\Program Files\\Inkscape\\bin;' + os.environ["PATH"]

This seems reasonable since the bin dir is not included in the standard inkscape distro. Is there a way to avoid this? Is it a result of my "dirty" installation procedure (just copying the files into the Inkscape dir)?

Thanks in advance!

Revision history for this message
Patrick Storz (ede123) wrote :

> One open question:
> In BOTH cases I had to manually add the path to the subdir "bin"

Hm, "BOTH" meaning with Tkinter as well as with pygtk?

I have not tried pygtk, but for the simple Tkinter GUI I tried I did not have to set up any paths after the fixes from above.

Note that (mainly for historical reasons*) we copy all binaries from /bin directly into the installation root, so you might want do that, too (unless you want to adjust search paths).
For most relocatable binaries this works just fine except for the few cases where it doesn't (like tcl initially).

*maybe this is something we could/should change eventually but I felt this could be too big a change for the 0.92.x branch as it also requires some code changes to attribute for the changed paths.

Revision history for this message
Jan Winkler (jcwinkler) wrote :

I see, thank you. After copying the files included in the bin directory into the Inkscape root directory Tkinter works. The same holds for PyGTK. So everything is fine now an I will ship a new TexText beta release which addresses the new python installation structure under Windows.

OT: Since a major rework of the Plugin is necessary I have several questions w.r.t. to the Inkscape plugin interface, esp. about plans in the future, about similar or planned LaTeX approaches, etc. What is the right place to discuss these topics? Ask a question in this tracker? Or the mailing list on SourceForge? Or anywhere else? Thanks in advance for any hints!

Revision history for this message
Patrick Storz (ede123) wrote :

Great, good to know you were successful.

Development related topics are best discussed on the inkscape-devel mailing list.
For quick feedback you can also try the #inkscape-devel IRC channel which is sometimes helpful to get a first impression before writing to the mailing list.

Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers