How To Make A Gui In Python

In this tutorial, we will learn how to create a Graphical User Interface (GUI) in Python using the popular library Tkinter. GUIs are an essential aspect of modern-day applications since they provide a highly interactive user experience.

We will break down the process into easy-to-follow steps so that even those with little or no experience in Python or Tkinter can follow along.

Step 1: Install Tkinter

Tkinter comes bundled with Python installations, so you don’t need to install it. However, if for some reason, Tkinter is not available, you can install it using the following command:

For Python 2.x, use:

For Python 3.x, use:

Step 2: Create a Basic Window

To get started, you need to import the Tkinter module and create a basic window. The following code will create a simple window and display it until the user closes it.

Step 3: Add Widgets to the Window

Tkinter offers various widgets like buttons, labels, input boxes, etc. Let’s start by adding a label and a button to our window.

The Label and Button widgets have been added to the main window, and the text in the label will be updated when the button is clicked.

Step 4: Organize Widgets Using Frames and Layout Managers

In most cases, you will want to organize your widgets within frames and use a layout manager to control their positioning. The following example demonstrates how to use the grid layout manager to create a simple calculator layout.

This code creates a simple calculator layout using the grid layout manager. You can experiment with other layout managers such as pack() and place() depending on your requirements.


In this tutorial, we learned how to create basic GUIs in Python using Tkinter. We covered the installation process, creating a simple window, adding widgets, and using layout managers to organize the widgets.

With this knowledge, you can explore and experiment with more Tkinter widgets and create more advanced GUI applications suited to your needs. You can also check out the official Tkinter documentation for a comprehensive overview of Tkinter functionalities.