FIFA-2022 Career Guide Free Tutorials Go to Your University Placement Preparation 
1 like 0 dislike
in Python Programming by Goeduhub's Expert (3.1k points)
edited by

In this tutorial we will deal with GUI (Graphical user interface) in python. Basically in python we have tkinter library to create GUI.  This Article consists the installation , use of tkinter and methods /functions of tkinter library.

Calculator using GUI in Python 

Related Links: Basic Python 

by (100 points)
Most useful module I learned until now is gui and tkinter in python.

3 Answers

0 like 0 dislike
by Goeduhub's Expert (3.1k points)
edited by
Best answer

Python GUI 

GUI (Graphical user interface)

GUI is desktop application which helps a human to interact with computers, electronic devices,They are used to perform different tasks in the desktops, laptops and other electronic devices.


  1. Text-Editors (Notepad etc)
  2. Games- Sudoku , Chess
  3. Browser- Google Chrome, Firefox

How to create these applications ?

  • Python is used to create Graphical User Interfaces (GUI) applications.

  • Python Libraries To Create Graphical User Interfaces

  • Tkinter , Kivy , wxpython ,QT python ,Jpyhton 

  • Here we are going to use tkinter as it is easy to learn.

Python Tkinter 

  •  Python has inbuilt Tkinter library for creating the GUI  desktop based applications.

Steps followed to create a tkinter GUI application

  • Import the tkinter module.
  • Create a main window 
  • Add widgets 
  • Enter the main event loop.


import tkinter  # Importing tkinter module

Goe=tkinter.Tk()  #creating a  main window with name Tk.

#Add widgets here 

Goe.mainloop() #Event loop


Note :- Tkinter offer a method called Tk to create a main window.

Tk(screenName=None,  baseName=None,  className=’Tk’,  useTk=1), in abouve example we use className.

Note :-Event main loop is used to display window until an event to occur.

geometry managers

  • pack() :-Organizes widgets in blocks before placing them in the parent widget.
  • grid() :- Organizes widgets in a table-like structure in the parent widget.
  • place():- Place widgets on specific positions as you want.

Tkinter Widgets

  • There are a number of widgets.
  • Tkinter provides various controls, used in a GUI application, Known as widgets.
Widget methods()Description

To add various kinds of buttons in GUI app

Canvas This widget is used to shapes in GUI
Labelused to display some message or information about the other widgets
Entry used to display the single-line text field to the user
FrameFrame is used as container 
Menuused to add menu items to the user
Message Display message box to the user
ScrollbarUsed to scroll window up and down 
TextThe Text widget is used to display text in multiple lines
SpinboxIt same as scrollbar but has two tabs one is and one is down

Some common parameters of widget methods.

  • bg- To set background color.
  • font- to set the font on the button label.
  • command-to call a function.
  • width: For width of the widget.
  • height: For the height of the widget.
  • cursor: to set the cursor used in the canvas

 Examples of some widgets methods

  1. Button widget


import tkinter as tk 

var= tk.Tk() 

var.title('Counting Seconds') 

button = tk.Button(var, text='Goedehub technologies',width=50,bg="red") 




Note:- pack() is used to show objects in the window

2. Canvas


from tkinter import *

var = Tk() 

canvas = Canvas(var, width=50, height=50 , bg="red") 




x = int(canvas_height / 2)

y= int(canvas_height / 2)

canvas.create_line(x, y, canvas_width, y ) 





from tkinter import * 

var = Tk()

name = Label(var,text = "Name")

name.grid(row = 0, column = 0) 

e1 = Entry(var).grid(row = 0, column = 1)  

password = Label(var,text = "Password").grid(row = 1, column = 0)  

e2 = Entry(var).grid(row = 1, column = 1)  

submit = Button(var, text = "Submit", fg = "red").grid(row = 4, 





Note:- Geometry is used for size of window



from tkinter import *

var= Tk() 

label = Label(var, text='GOeduhub Technologies') 





Calculator App using tkinter

Python Tutorial 

Machine Learning Tutorial 

AI Tutorial

Free Online Tutorials

by (294 points)
With the help of GUI we developed the desktop app using python
by (422 points)
Each widgets are explain with proper examples.
by (100 points)
An application which is used for interaction between human and computer.
there are so many libraries in python for GUI, here we learned about tkinter.
Steps to create a GUI using Tkinter are as followed:
  Import the tkinter module.
  Create a main window
  Add widgets
  Enter the main event loop.
0 like 0 dislike
by (391 points)

Date: 02/05/2020

Topic: Python GUI and Tkinter

A Graphical User Interface is a application to connect humans with the server and devices. there is some of the method which is used to make GUI.

0 like 0 dislike
by (294 points)
In this chapter I learned about the GUI AND TKINTER .

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

Related questions

0 like 0 dislike
1 answer 4.0k views
2 like 0 dislike
7 answers 10.1k views
2 like 0 dislike
4 answers 4.0k views
asked Dec 21, 2019 in Python Programming by Nisha Goeduhub's Expert (3.1k points)
0 like 0 dislike
5 answers 2.5k views
0 like 0 dislike
4 answers 2.5k views

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs


About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © Social::   |  | 


Free Online Directory