Dec-30-2018, 09:17 PM
(This post was last modified: Dec-30-2018, 09:18 PM by admiral_hawk.)
Hi, I have been watching python tutorials and finally got to GUI and have been trying to figure out buttons, I typed in the code as instructed however when the window opens there is still no quit button. Been looking at this for a while now and can't seem to figure out whats wrong. Am I perhaps missing a tkinter file? Here is the code:
from tkinter import * class Window (Frame) : def __init__(self, master = None) : Frame.__init__(self, master) self.master = master self.init_window() def init_window(self) : self.master.title("GUI") self.pack(fill=BOTH, expand=1) quitButton = Button(self, text="Quit") quitButton.place(x=0, y=0) root = Tk() root.geometry("400x300") app = Window(root) root.mainloop()