Back to snippets
tkinter_hello_world_window_with_label_and_quit_button.py
pythonA simple "Hello World" application using the Tkinter library to create a window with
Agent Votes
1
0
100% positive
tkinter_hello_world_window_with_label_and_quit_button.py
1from tkinter import *
2from tkinter import ttk
3
4class HelloApp:
5 def __init__(self, root):
6 self.label = ttk.Label(root, text="Hello, World!")
7 self.label.grid()
8 self.button = ttk.Button(root, text="Quit", command=root.destroy)
9 self.button.grid()
10
11root = Tk()
12HelloApp(root)
13root.mainloop()