Python 3 Tkinter root.quit() Method to Close or Quit Window or Application in GUI Desktop App Full Tutorial For Beginners

Python 3 Tkinter root.quit() Method to Close or Quit Window or Application in GUI Desktop App Full Tutorial For Beginners

 

Welcome folks today in this blog post we will be using root.quit() method to close or quit window or application in tkinter gui desktop app in python. All the full source code of the application is given below.

 

 

Get Started

 

 

In order to get started you need to install the below library using the pip command as shown below

 

pip install tkinter

 

After installing this library you need to make an app.py file and copy paste the following code

 

app.py

 

from tkinter import *
  
# Creating the tkinter window 
root = Tk() 
root.geometry("200x100") 
  
# Button for closing 
exit_button = Button(root, text="Exit", command=root.quit) 
exit_button.pack(pady=20) 
  
root.mainloop() 
exit(0)

 

 

If you execute the above python script by typing the below command

See also  Python Tkinter GUI Script to Build Music Mp3 Player Using Pygame,WinSound and Pickle Library Full Project For Beginners

 

python app.py

 

 

Leave a Reply