In this tutorial, we are going to learn about Tkinter Introduction which is a  GUI toolkit for Python. We will learn how to create buttons, frames, checkboxes, radio buttons etc by following a few easy steps. You can become a pro in using Tkinter in no time.

Recommended Book: Python GUI Programming with Tkinter

The tkinter package is a known standard Graphical User Interface (GUI) toolkit for Python, also it is the most commonly used one as well.

Tkinter Introduction: Importing Tkinter

In order to start making interfaces using tkinter, you need to import it first by simply using the import statement.

import tkinter

Creating your First Tkinter Window

Once we have imported the tkinter module, it is time to create our first tkinter main window as ‘screen’. You can use any other variable as you like.

import tkinter as tk
screen = tk.Tk()

We have imported the tkinter module as tk and set the variable ‘screen’ equals to the Tk() method to create a window. In order to keep the window on loop and keep appearing until the user closes the window we use the mainloop() method. If you don’t add mainloop() method at the end of your code then the code will run once and then self closes itself. So, in order to keep it on the screen, make sure that you use the mainloop() method.

Using Tkinter Widgets

There are multiple widgets that you can use to start making stuff in tkinter: