def __init__(self, master, *args, **kwargs): Frame.__init__(self, master, *args, **kwargs) # define our master frame configuration self.master = master self.master.minsize(550, 340) # (Height, Width) self.master.maxsize(550, 340) # This CenterWindow method will center our app on the user's screen drill50_phonebook_func.center_window(self, 550, 340) self.master.title("The Tkinter Phonebook Demo") self.master.configure(bg="#F0F0F0") # This protocol method is a tkinter built-in method to catch if # the user clicks the upper corner, "X" on Windows OS. self.master.protocol("WM_DELETE_WINDOW", lambda: drill50_phonebook_func.ask_quit(self)) arg = self.master # load in the GUI widgets from a separate module, # keeping your code compartmentalized and clutter free drill50_phonebook_gui.load_gui(self) # Instantiate the Tkinter menu drop-down object # This is the menu that will appear at the top of our window menubar = Menu(self.master) filemenu = Menu(menubar, tearoff=0) filemenu.add_separator() filemenu.add_command( label="Exit", underline=1, accelerator="Ctrl+Q", command=lambda: drill50_phonebook_func.ask_quit(self), ) menubar.add_cascade(label="File", underline=0, menu=filemenu) helpmenu = Menu( menubar, tearoff=0 ) # defines the particular drop down column and tearoff=0 means do not separate from menubar helpmenu.add_separator() helpmenu.add_command(label="How to use this program") helpmenu.add_separator() helpmenu.add_command( label="About This Phonebook Demo" ) # add_command is a child menubar item of the add_cascade parent item menubar.add_cascade( label="Help", menu=helpmenu ) # add_cascade is a parent menubar item (visible heading) """ Finally, we apply the config method of the widget to display the menu From here we could also pass in additional aprams for additional functionalityor appearances such as a borderwidth. """ self.master.config(menu=menubar, borderwidth="1")
def __init__(self, master, *args, **kwargs): Frame.__init__(self, master, *args, **kwargs) # define our master frame configuration self.master = master self.master.minsize(200, 500) #(Height, Width) self.master.maxsize(400, 1000) # This CenterWindow method will center our app on the user's screen drill50_phonebook_func.center_window(self, 200, 500) self.master.title("Check Files") self.master.configure(bg="#F0F0F0") # This protocol method is a tkinter built-in method to catch if # the user clicks the upper corner, "X" on Windows OS. self.master.protocol("WM_DELETE_WINDOW", lambda: drill50_phonebook_func.ask_quit(self)) # load in the GUI widgets from a separate module, # keeping your code comparmentalized and clutter free drill50_phonebook_gui.load_gui(self)
def __init__(self, master, *args, **kwargs): Frame.__init__(self, master, *args, **kwargs) # This section will define out master frame configuration - incuding the address # to get it from and the size self.master = master self.master.minsize(500, 300) #This is the height and width in pixels self.master.maxsize(500, 300) # You will not the size is fixed # This CenterWindow method will center our app on the user's screen drill50_phonebook_func.center_window(self, 500, 300) # This is the title self.master.title("The Tkinter Phonebook Demo") # This is the background color self.master.configure(bg="#F0F0F0") # This protocol method is a tkinter built-in method to catch if # the user clicks the upper corner, "X" on Windows OS. self.master.protocol("WM_DELETE_WINDOW", lambda: drill50_phonebook_func.ask_quit(self)) arg = self.master # load in the GUI widgets from a seperate module, # keeping your code comparmentalized and clutter free drill50_phonebook_gui.load_gui(self)