def main(root, text, menubar): objFormat = Format(text) fontoptions = families(root) font = Font(family="Arial", size=10) text.configure(font=font) SettingsManager.setup(objFormat, font) # setup the settings formatMenu = Menu(menubar, tearoff=False) fsubmenu = Menu(formatMenu, tearoff=False) ssubmenu = Menu(formatMenu, tearoff=False) for option in fontoptions: fsubmenu.add_command(label=option, command=lambda option=option: SettingsManager.change_font(font, "font_family", option)) for value in range(1, 31): ssubmenu.add_command(label=str(value), command=lambda value=value: SettingsManager.change_font(font, "font_size", value)) formatMenu.add_command(label="Change Background", command=objFormat.changeBg) formatMenu.add_command(label="Change Font Color", command=objFormat.changeFg) formatMenu.add_cascade(label="Font", underline=0, menu=fsubmenu) formatMenu.add_cascade(label="Size", underline=0, menu=ssubmenu) formatMenu.add_command(label="Bold", command=objFormat.bold, accelerator="Ctrl+B") formatMenu.add_command(label="Italic", command=objFormat.italic, accelerator="Ctrl+I") formatMenu.add_command(label="Underline", command=objFormat.underline, accelerator="Ctrl+U") formatMenu.add_command(label="Overstrike", command=objFormat.overstrike, accelerator="Ctrl+T") formatMenu.add_command(label="Add Date", command=objFormat.addDate) menubar.add_cascade(label="Format", menu=formatMenu) root.bind_all("<Control-b>", objFormat.bold) root.bind_all("<Control-i>", objFormat.italic) root.bind_all("<Control-u>", objFormat.underline) root.bind_all("<Control-T>", objFormat.overstrike) root.grid_columnconfigure(0, weight=1) root.resizable(True, True) root.config(menu=menubar)