Python Tutorial

Introduction to Python Tkinter Explained [With Example]

What is Tkinter in Python?

Tkinter is Python's standard graphical user interface package. Creating graphical user interfaces is quick and easy when Python is used in combination with Tkinter. It is a powerful object-oriented interface included with the Tk GUI toolkit.

Tkinter makes it simple to create a graphical user interface (GUI). All you need to do is follow the procedures outlined below.

1. Install the Tkinter module.

2. Make the primary window of the GUI program.

3. Add one or more of the widgets listed above to the GUI program.

4. Enter the main event loop to act on each event that the user has triggered.

Example:

#!/usr/bin/python

import Tkinter

top = Tkinter.Tk()

# Code to add widgets will go here...

top.mainloop()

This would create the following window:

What is Tkinter in Python

Did you find this article helpful?