Getting Started with Python GUI Tkinter

In this tutorial, I’ll talk about what is Python Tkinter GUI and how to create first  GUI application using Tkinter.

What is Tkinter?

Tkinter is Python GUI Library or module. Tkinter library already included with python installation package. When Python combined with Tkinter offers a very easy and fast way to create GUI (Graphical User Interface) applications.  Alternatives of Tkinter are also available like PyQt, wxPython, Pyside, Pyglet, PyGTK and Pygame.


First Python Tkinter application (Window box with Title)

Check the following example to understand how to create first GUI application








Understanding With Code

import tkinter as tk: it is used to import tkinter Library. We are using the alias tk, That’s why we don’t have need to use the longer word tkinter we can use tk in the place of tkinter.

window = tk.Tk(): Create an instance of the Tk class by calling its constructor


window.title(“Python First GUI”):  It is used to add “Python First GUI” title to window

window.mainloop(): In Python mainloop() method Is used to wait for an event to occur, as long as the window is not closed.


Get More Python Tutorials