Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing TkinterTreectrl on Windows

I tried to install TkTreectrl on Windows7 without success. I downloaded the package of version 2.0.1 unzipped and tried to run the setup.py. That one complained in the first place alway that the folder TkTreectrl doesn't exist, which was wrong since the folder comes with the download and I was running setup.py within the same directory where TkTreectrl was located.

According to the readme file there is another option to install and that would be to copy the TkTreectrl folder into the site-packages directory. So, I did this, and nothing changed. Then I did run setup.py again and it didnt complain about a missing TkTreectrl folder.

However,

from Tkinter import *
import TkTreectrl as Tktree
root = Tk()
t=Tktree.Treectrl(root, width=20, height=20).pack()
root.mainloop()

comes back with the error message:

ver = master.tk.call('package', 'require', 'treectrl') _tkinter.TclError: can't find package treectrl

Could somebody tell me where my error is?

Cheers

like image 411
Thomas Becker Avatar asked Nov 02 '22 10:11

Thomas Becker


2 Answers

Well tk is a whole different language itself. There should be a file for that widget which manages everything for that widget. All python does is interpret that and just allow us to use that in tkinter. So odds are you don't have the file or if you do it is in the wrong place.

like image 138
user3308930 Avatar answered Nov 15 '22 12:11

user3308930


In order to use TKTreectrl you need to also have the Tcl/Tk treectrl package installed.

From http://tkintertreectrl.sourceforge.net/ under Installation:

Of course you will also have to install the Tcl/Tk treectrl package to be able to use the TkTreectrl module.

On windows systems simply download the tktreectrl-2.x.x-Tk8.x-win32.zip archive suitable for the Tk version in use and copy the contents of the archive into your Python installation's tcl folder.

On unix systems you will probably have to compile the treectrl package from the sources. To do so, download and unpack the latest tktreectrl-2.x.x.tar.gz archive, cd into the tktreectrl-2.x.x directory and type (as root)

./configure && make && make install

If this fails it is most likely because configure cannot find the Tcl installation. In this case (or if you have multiple versions of Tcl/Tk installed) you have to pass the paths to the tclConfig.sh and tkConfig.sh to configure , as for example:

./configure --with-tcl=/usr/lib/tcl8.4 --with-tk=/usr/lib/tk8.4  
make  
make install
like image 26
keelimeguy Avatar answered Nov 15 '22 12:11

keelimeguy