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

Viewed 43775

Hi have been scavenging the web for answers on how to do this but there was no direct answer. Does anyone know how I can find the version number of tkinter?

6 Answers

Previous answers describe tkinter.TclVersion and tkinter.TkVersion that provide the major and minor Tcl/Tk versions but not the patch number.

To get the full version in the major.minor.patch format, you could use the info patchlevel Tcl command.

For example:

import tkinter

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

# Output:
# 8.6.10

To do the same from a Tkinter app, which already has an associated Tcl interpreter, you could run this instead:

import tkinter

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

# Output:
# 8.6.10

Type this command on the Terminal and run it.

python -m tkinter

A small window will appear with the heading tk and two buttons: Click Me! and QUIT. There will be a text that goes like This is Tcl/Tk version ___. The version number will be displayed in the place of the underscores.

You cal so invoke TclVersion:

>>> import tkinter
>>> tkinter.TclVersion
8.6

Tested for Python 3.6.5 and Python 3.5.2 (Ubuntu 16.04.4):

In the terminal try as follows:

python -m tkinter or python3 -m tkinter
Related