tkinter TclError: can't find package treectrl tkinter TclError: can't find package treectrl tkinter tkinter

tkinter TclError: can't find package treectrl


This might not be an exhaustive answer, but it can be helpful.

It is probably because your tcl/tk version does not contain a subpackage called treectrl, from the following error:

_tkinter.TclError: can't find package treectrl

The wrapper library you are using TkTreectrl for tkinter has this statement somewhere:

ver = master.tk.call('package', 'require', 'treectrl')

which means you are trying to import the package treectrl from tk, but apparently that package does not exist. My advice is to checkout your version of tcl/tk and then check if it includes treectrl.

You can check your tcl and tk version with the following commands (on Python 3):

>>> import tkinter>>> tkinter.TkVersion8.5>>> tkinter.TclVersion8.5>>>

Maybe from the following link you can checkout if treectrl package is included in the Tk version 8.5: https://www.tcl.tk/man/tcl8.5/

Similarly, you can do it for your tcl/tk version, if different from mine.

My guess is that you need first to install treectrl which might be an extension for your tcl/tk distribution.


I got this error when installing TkTreectrl in LINUX.This problem happens TCL cannot find the treectrl package.To fix the problem, you have to find the path that TCL is looking for the treectrl package.Create a TCL file called test.tcl with the following lines.

puts $tcl_pkgPathputs $auto_path

Type the following command at the LINUX prompt to run the code and note the output

tclsh test.tcl

In my case, the output was

/usr/lib64/tcl8.6

I discovered that my treectrl2.4.1 directory was in /usr/lib, so from the LINUX prompt, I entered the following commands:

cd /usr/libcp -R treectrl2.4.1 /usr/lib64/tcl8.6/

And that fixed the problem for me.