python tkinter simple gui with quit button

Solutions on MaxInterview for python tkinter simple gui with quit button by the best coders in the world

showing results for - "python tkinter simple gui with quit button"
Nicola
17 Sep 2016
1import tkinter as tk
2from tkinter import ttk
3
4# Create the application window
5window = tk.Tk()
6
7# Create the user interface
8my_label = ttk.Label(window, text="Hello World")
9my_label.grid(row=1, column=1)
10
11quit_button = ttk.Button(window, text="Quit")
12quit_button.grid(row=2, column=1)
13quit_button['command'] = window.destroy
14
15# Start the GUI event loop
16window.mainloop()
17