tktable
tktable copied to clipboard
"_tkinter.TclError: can't find package Tktable" when running the sample_test() function
I am getting this error on running tktable.py
.
It should run a sample_test()
within the file.
Error:
Traceback (most recent call last):
File "tktable.py", line 636, in <module>
sample_test()
File "tktable.py", line 628, in sample_test
command=test_cmd)
File "tktable.py", line 124, in __init__
master.tk.call('package', 'require', 'Tktable')
_tkinter.TclError: can't find package Tktable
I get a similar error when I import tktable to my code and create an object.
Please suggest.
Thanks for your time.
I am working with Python 2.7.3
@mejaz The error is at this line: master.tk.call('package', 'require', 'Tktable')
, when tkinter tries to do a low-level call to tcl/tk by requiring the tktable
.
-
Does using the usual widgets, i.e. text, label, button, etc, cause any problem?
If not, I think that the problem is because, as the error suggests, tkinter can't find the underlying widget tktable (which, if I'm not wrong, is also an extension to the core tk widgets), either because your version of tcl/tk does not support it or it could also be because of something else...
-
Which OS are you working on?
-
Can you tell us your tcl/tk version?
I would advise you to ask this question on Stack Overflow by specifying the tkinter, tcl and tk tags in the question and of course mentioning this repository.
You could also try to write an e-mail to the creator of this wrapper library: @gpolo.
@mejaz Please, if you find an answer to your specific problem, share it with us. Also if you ask help about this problem, e.g. on Stack Overflow, try to tell us, because that would be helpful for whoever comes here to this repository and has this same issue.
@nbro
Yes, other features of my program are working fine. I have posted this question in Stack Overflow here
I'll post here once I get a resolution to this.
@mejaz Thanks for sharing it with everybody!
I saw on SO that they marked your question as duplicate. Does any of the answers to the other duplicated question solve your problem at the end?
The "duplicate" answer does not answer it completely, as it links to a page that considers only Windows. If you're using Linux, it depends on which package its package manager provides. There's a comment that mention apt-get install tk-table
, maybe that could work in this situation. If you're using OSX, at least the latest release includes Tktable so it should just work.
There's a simple test you can do to check if this Python wrapper will be able to run:
$ tclsh
% package require Tktable
the output from that will be either can't find package Tktable
or a string representing the version of the Tktable installed.
This might be confusing but this is a pure Python package named tktable, and it depends on Tktable which is an extension to Tk.
Here's other info and more details regarding the installation of the Tcl/Tk extension widget tktable in case it's not installed and you get the error _tkinter.TclError: can't find package Tktable
.
Linux
As @gpip mentioned in the previous comment apt-get install tk-table
may work in some Linux distributions, and these are a few more details and info I've gathered.
-
Fedora provides a package named
python2-tktable
which is this wrapper but only for Python 2 (UPDATE: see this). If I'm not wrong the original wrapper only supported Python 2, but I've added the try/except statements in this version to make it usable also by Python 3 users. See here the original wrapper uploaded by Jeff Hobbs, the original author of the Tcl/Tk extension widget tktable. - Here's the situation for Ubuntu: http://packages.ubuntu.com/search?keywords=tk-table&searchon=names
- Here's what I've found for Debian: https://packages.debian.org/search?keywords=tk-table
Mac OS X
For Mac OS X, tktable
is listed in the MacPorts repositories here. This means that theoretically you could also install tktable
using the following command port -v install tktable
, provided that you have MacPorts installed. Indeed port -v search tktable
should return you something like
tktable @2.10_1 (x11)
A table/matrix widget extension to Tk/Tcl
I don't know if you would need to configure something else or not.
Windows
I've not found any useful info apart from the one mentioned above.
ActiveState Tcl
What you could do also is install the ActiveState Tcl, which is a Tcl distribution provided by ActiveState, as the name suggests. There's a free community edition here. This distribution of Tcl should be shipped with a package manager, i.e. teacup
, which allows you to install tktable
as an extension for tk
.
This could be a clean way to install tktable
(especially for Windows and Mac OS X users), but I'm not sure if installing ActiveState Tcl, if you've already another distribution of Tcl, would cause you problems of conflicts.
Notes
I don't guarantee that any of the previous suggestions and options will work out.