예제 #1
0
    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()
예제 #2
0
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()))