Answers for "how to make a quit button in tkinter"

6

python tkinter close gui window

from tkinter import *
root=tk.Tk()
root.destroy()
Posted by: Guest on May-01-2020
0

Python TKinter simple GUI with quit button

import tkinter as tk
from tkinter import ttk

# Create the application window
window = tk.Tk()

# Create the user interface
my_label = ttk.Label(window, text="Hello World")
my_label.grid(row=1, column=1)

quit_button = ttk.Button(window, text="Quit")
quit_button.grid(row=2, column=1)
quit_button['command'] = window.destroy

# Start the GUI event loop
window.mainloop()
Posted by: Guest on June-15-2021

Code answers related to "how to make a quit button in tkinter"

Python Answers by Framework

Browse Popular Code Answers by Language