def __init__(self): #Create the main window self.root = tk.Tk() self.frame = MenuFrame(self) img = tk.PhotoImage(file='graphics/img/icon.gif') self.root.call('wm', 'iconphoto', self.root._w, img) self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) self.resize() self.root.resizable(False, False) self.root.title('Chess') self.root.mainloop()
class GUI(object): #GUI class def __init__(self): #Create the main window self.root = tk.Tk() self.frame = MenuFrame(self) img = tk.PhotoImage(file='graphics/img/icon.gif') self.root.call('wm', 'iconphoto', self.root._w, img) self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) self.resize() self.root.resizable(False, False) self.root.title('Chess') self.root.mainloop() def switch_frame(self, frame_cls, *args): """ When called, changes the interface of the window """ self.frame.destroy() self.frame = frame_cls(self, *args) self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) self.resize() def resize(self): self.root.update() self.root.wm_geometry("{}x{}".format(self.root.winfo_reqwidth(), self.root.winfo_reqheight()))