Tkinter: Python in-built Graphical User Interface (GUI)

Amit Chauhan
3 min readJul 10, 2022

Creating GUI-based application with python examples

Photo by Taras Shypka on Unsplash

Graphical user interfaces in everywhere in our technology, where we interact with the function of electronic devices through touch buttons, input box, audio, visual information, etc.

Introduction

The Tkinter is python’s in-built library to make basic to advance graphical user interface applications. There are many elements in the Tkinter to create GUI and these elements are buttons, entry fields, text, menu, scrollbar, etc.

Example 1

Let’s see the basic example of creating a simple button GUI with python.

#importing all the class methods from the Tkinter
from tkinter import *
#First we need to create a root window, where all these elements can
#can be used upon
root = Tk()

The Tk() is a instance that helps and manages the root window and its elements.

#frame is a space where we use our elements to be place
frame = Frame(root)
#It used to manage of placing elements in the frame
frame.pack()
#creating button inside the frame
button = Button(frame, text ='Hello World')
button.pack()

--

--

Amit Chauhan
Amit Chauhan

Written by Amit Chauhan

Data Scientist, AI/ML/DL, Azure Cloud

Responses (1)