Installation¶
pytktable requires Python >= 3.11 with tkinter, Python’s interface to Tcl/Tk.
With prebuilt Tktable (recommended)¶
pip install "pytktable[binary]"
This also installs pytktable-binaries, which contains Tktable, the Tcl/Tk extension that provides the table widget, compiled for Tcl/Tk 8.6 and 9.0 for:
Linux: x86_64 and ARM (aarch64), with glibc (most distributions) or musl (e.g. Alpine);
macOS 11 and later: Intel and Apple silicon;
Windows: x64, x86 and ARM.
pytktable finds it automatically, so you don’t need to install Tktable or set TKTABLE_LIBRARY.
You only need tkinter, which the python.org installers for Windows and macOS include. On Linux,
install your distribution’s tkinter package, e.g.:
sudo apt install python3-tk
on Debian and Ubuntu, or:
sudo dnf install python3-tkinter
on Fedora. Tktable also needs the X11 library (libX11), which every desktop Linux has.
Without prebuilt Tktable¶
Install only the Python wrapper, and Tktable yourself, if:
your platform is not in the list above (e.g. 32-bit ARM Linux, FreeBSD);
you prefer the Tktable of your OS’s package manager;
the prebuilt Tktable doesn’t work for you (please report it).
pip install pytktable
Then install these, which pip install pytktable does not install:
How to install them depends on your OS:
Check the installation¶
python -m tktable
This prints the versions of Python, Tcl and Tk, where Tcl looks for extensions (auto_path), and
whether Tktable can be found and loaded. It exits with status 0 on success. See python -m tktable
for details.
Tktable in a non-standard location¶
If Tktable is installed in a directory Tcl does not search, set the environment variable
TKTABLE_LIBRARY to the directory containing Tktable’s pkgIndex.tcl. That directory is named
after Tktable’s version, e.g. Tktable2.10 for Tktable 2.10. See your OS page for how to set it.
Troubleshooting¶
_tkinter.TclError: can't find package Tktableorinvalid command name "table"Tcl cannot find Tktable. Install pytktable with prebuilt Tktable, or install Tktable and, if needed, set
TKTABLE_LIBRARY.TableraisesCannotUseErrorin this case.ModuleNotFoundError: No module named 'tkinter'tkinter is not installed for your Python. On Linux, install your distribution’s tkinter package (see above).
- Tktable is found but fails to load
It was probably built for a different Tcl/Tk version than the one your Python uses (e.g. Tcl 8.6 vs 9.0).
python -m tktableshows both.