How to determine what version of python3 tkinter is installed on my linux machine?

In Python 3, it's tkinter with a small t, and you need to import it. Thus:

>>> import tkinter
>>> tkinter.TkVersion
8.6

If you didn't import it, you'd get the error you mentioned.


Previous answers (tkinter.TclVersion and tkinter.TkVersion) are simple and often sufficient -- you can get major and minor version numbers. But they don't give you the patch version as well.

To get the full version (major.minor.patch), use the info patchlevel Tcl command instead.

First, you have to start a Tcl interpreter instance. Tkinter provides several ways of doing that.

The first one is to create a Tcl interpreter instance without Tk (using tkinter.Tcl()).

import tkinter


tcl = tkinter.Tcl().
print(tcl.call("info", "patchlevel"))

# Output:
# 8.6.10

But if you are trying to get the full version of Tcl/Tk from a Tkinter-based application, it is unwise to use the first approach. Since tkinter.Tk() also has an associated Tcl interpreter, you can use that one instead of creating a new one:

import tkinter


root = tkinter.Tk()
...
print(root.tk.call("info", "patchlevel"))
...
root.destroy()

# Output:
# 8.6.10

Run Tkinter.TclVersion or Tkinter.TkVersion and if both are not working, try Tkinter.__version__