In order to install tkinter in a local computer, we use several commands on the basis of our OS architecture. There are two ways to import the tkinter library in our Window-based machine which are based on the Python version. Earlier, for lower versions of Python, we generally used to import the tkinter library using the following command −
from Tkinter import *
However, for Python 3 or later, we generally import the Tkinter library in the environment using the following command −
from tkinter import *
The only difference between Tkinter and tkinter is that Tkinter was initially used with Python 2 and tkinter is used for working with Python 3 or later versions.
Try to run this simple code in Python 3 or higher, it will display an error message.
#Import the tkinter library from Tkinter import * #Create an instance of tkinter frame win = Tk() #Set the geometry win.geometry("650x200") win.mainloop()
ModuleNotFoundError: No module named 'Tkinter'