Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- class Application(tk.Frame):
- def __init__(self, master=None):
- super().__init__(master)
- self.pack()
- self.create_widgets()
- def create_widgets(self):
- self.hi_there = tk.Button(self)
- self.hi_there["text"] = "Hello, World!"
- self.hi_there["command"] = self.say_hi
- self.hi_there.pack(side="top")
- self.quit = tk.Button(self, text="QUIT", fg="red",
- command=root.destroy)
- self.quit.pack(side="bottom")
- def say_hi(self):
- print("Hello, world!")
- root = tk.Tk()
- app = Application(master=root)
- app.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement