In 2008, Guido van Rossum, the author of Python, forked the language into two branches—2.x, and 3.x. This was done to clean up and make the language more consistent.
Python 3.x broke backward compatibility with the Python 2.x. For example, the print statement in Python 2.x was replaced by print()
function that would now take arguments as parameters.
We coded all our Tkinter programs in Python Version 2.7, because it has a richer set of third-party libraries than Python 3.x, which is still considered a developing version.
The core functionality of Tkinter remains the same between 2.x, and 3.x. The only significant change to Tkinter when moving from Python 2.x to Python 3.x involves changing the way Tkinter modules are imported.
Tkinter has been renamed to tkinter in Python 3.x (capitalization has been removed). Note that in 3.x, the directory lib-tk
was renamed to tkinter
. Inside the directory, the file Tkinter.py
was renamed to __init__.py
, thus making tkinter an importable module.
Accordingly, the biggest major difference lies in the way you import the Tkinter module into your current namespace:
from Tkinter import * # for Python2 from tkinter import * # for Python3
Further, take a note of the following changes:
Python 2.x |
Python 3.x |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3.145.70.38