Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

"_tkinter.TclError: can't find package Tktable" when running the sample_test() function #1

Open
mejaz opened this issue Aug 28, 2016 · 7 comments

Comments

@mejaz
Copy link

mejaz commented Aug 28, 2016

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.

@mejaz
Copy link
Author

mejaz commented Aug 28, 2016

I am working with Python 2.7.3

@nbro
Copy link
Owner

nbro commented Aug 28, 2016

@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.

  1. 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...

  2. Which OS are you working on?

  3. 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.

@nbro
Copy link
Owner

nbro commented Aug 28, 2016

@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.

@mejaz
Copy link
Author

mejaz commented Aug 29, 2016

@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.

@nbro
Copy link
Owner

nbro commented Aug 31, 2016

@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?

@gpip
Copy link
Collaborator

gpip commented Sep 1, 2016

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.

@nbro nbro changed the title On running the sample_test(), getting error. "_tkinter.TclError: can't find package Tktable" when running the sample_test() function Sep 1, 2016
@nbro nbro changed the title "_tkinter.TclError: can't find package Tktable" when running the sample_test() function "_tkinter.TclError: can't find package Tktable" when running the sample_test() function Sep 1, 2016
@nbro
Copy link
Owner

nbro commented Sep 3, 2016

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.

  1. 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.
  2. Here's the situation for Ubuntu: http://packages.ubuntu.com/search?keywords=tk-table&searchon=names
  3. 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants