How to close a window in Tkinter? Last Updated : 09 Dec, 2020 Comments Improve Suggest changes Like Article Like Report Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with tkinter is the fastest and easiest way to create GUI applications. Creating a GUI using tkinter is an easy task. To close a tkinter window, we can use the destroy() method. The destroy() is a universal widget method i.e we can use this method with any of the available widgets as well as with the main tkinter window. Example: In the below example, we are going to implement the destroy() method using a button. Python # import required module from tkinter import * # create object root = Tk() # create button to implement destroy() Button(root, text="Quit", command=root.destroy).pack() root.mainloop() Output: In the above example, on clicking the button the destroy() method is called and the tkinter window is closed. Comment More infoAdvertise with us Next Article How to close a window in Tkinter? H hemsharan2050 Follow Improve Article Tags : Technical Scripter Python Technical Scripter 2020 Python-tkinter Python-gui +1 More Practice Tags : python Similar Reads How to Close a Tkinter Window With a Button? Prerequisites: Tkinter Python's Tkinter module offers the Button function to create a button in a Tkinter Window to execute any task once the button is clicked. The task can be assigned in the command parameter of Button() function. Given below are various methods by which this can be achieved. Meth 3 min read How to add a margin to a tkinter window? In this article, we will see how to add a margin to the Tkinter window. We will use the frame for adding the margin: Syntax: Frame(root, options) Approach: Importing the module.Create the main window (container)Use frame and frame.pack()Apply the event Trigger on the widgets. Without using frame me 2 min read How to Create Full Screen Window in Tkinter? Prerequisite: Tkinter There are two ways to create a full screen window in tkinter using standard python library for creating GUI applications. Method 1: Using attributes() function Syntax: window_name.attributes('-fullscreen',True) We will set the parameter '-fullscreen' of attributes() to True for 3 min read How To Center A Window On The Screen In Tkinter? Tkinter provides a basic geometry manager to control the placement of widgets within a window, it doesn't offer a built-in method to automatically center a window on the screen. However, achieving this task is relatively straightforward with a few lines of code. In this article, we'll explore differ 2 min read Python Tkinter - Frameless window Prerequisite: Python GUI â tkinter Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. To create a Frameless window, we will us 1 min read How to close only the TopLevel window in Python Tkinter? In this article, we will be discussing how to close only the TopLevel window in Python Tkinter. Syntax: def exit_btn():   top.destroy()   top.update() btn = Button(top,text='#Text of the exit button',command=exit_btn) Stepwise Implementation Step 1: First of all, import the library tkinter. from 3 min read Make a Tkinter Window Jump to the Front Making a Tkinter window jump to the front means bringing it to the top of all other windows, ensuring it grabs the user's attention. This can be particularly useful in applications that need to prompt the user for input or display important information. In this article, we will explore two different 2 min read How To Bind The Enter Key To A Tkinter Window? Tkinter is a Python library to develop GUI applications. Tkinter has many useful widgets that are necessary to build desktop applications. In this article, we will learn how to bind an Entry widget with a Tkinter Window. Binding Key in TkinterA key event occurs when the user clicks on any key on the 4 min read How to clear Tkinter Canvas? Tkinter is a Python Package for creating effective GUI applications. Tkinter's Canvas widget is nothing but a rectangular area that is used for drawing pictures, simple shapes, or any complex graph. We can place any widgets like text, button, or frames on the canvas. The task here is to generate a P 2 min read OpenCV Python: How to detect if a window is closed? OpenCV in Python provides a method cv2.getWindowProperty() to detect whether a window is closed or open. getWindowProperty() returns -1 if all windows are closed. This is one of the main problems we face while using the OpenCV package, sometimes it's hard to detect whether the window is open or clos 2 min read Like