Answers for "Python TKinter simple GUI with quit button"

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

Python Answers by Framework

Browse Popular Code Answers by Language