import tkinter as tk class Application(tk.Frame): def _init_(self, master = None): tk.Frame._init_(self, master) self.pack() self.createWidgets() def createWidgets(self): self.hi_there = tk.Button(self) self.hi_there["text"] = "Hello World\n(Click Me!)" 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 ("Hi there, everyone!") root = tk.Tk() app = Application(master = root) app.mainloop()
So after retyping this and checking if it was right i ran it. A blank window came up (labeled tk) with nothing in it. Can someone please explain why? And can someone help me learn tkinter, or at least teach me the basics?