Hello, I am trying to build a gui with multiple frames using tkinter as shown in the code. At the top I would like to display a menubar in one of the frames. The menubar is not displayed. Please, can you spot the error in the code. Many thanks. mssaidy from tkinter import * import tkinter as tk #import Tkinter as Tk # Tkinter -> tkinter in Python3 root = Tk()
class App(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs) # create a Frame for the Text and Scrollbar container = tk.Frame(self, width=600, height=600) container.pack(side="top", fill="both", expand=True)
# adds a command to the menu option, calling it exit, and the # command it runs on event is client_exit filemenu.add_command(label="Exit", command=lambda: controller.show_frame(client_exit))
#added "file" to our menu menubar.add_cascade(label="File", menu=filemenu)
# create the file object) editmenu = tk.Menu(menubar)
# adds a command to the menu option, calling it exit, and the # command it runs on event is client_exit editmenu.add_command(label="Undo")
#added "file" to our menu menubar.add_cascade(label="Edit", menu=editmenu)
root.configure(menu=menubar)
# create a Text widget txt = Text(self, borderwidth=3, relief="sunken") txt.config(font=("consolas", 12), undo=True, wrap='word') txt.grid(row=0, column=0, sticky="nsew", padx=2, pady=2)
# create a Scrollbar and associate it with txt scrollb = Scrollbar(self, command=txt.yview) scrollb.grid(row=0, column=1, sticky='nsew') txt['yscrollcommand'] = scrollb.set
print("This is Start Page")
def load_all_alarms(self): print ("Load all Alarms...")
def clear_all_alarms(self): print ("clear all Alarms...")
# create a Text widget txt = tk.Text(self, borderwidth=3, relief="sunken") txt.config(font=("consolas", 12), undo=True, wrap='word') txt.grid(row=0, column=0, sticky="nsew", padx=2, pady=2)
# create a Scrollbar and associate it with txt scrollb = tk.Scrollbar(self, command=txt.yview) scrollb.grid(row=0, column=1, sticky='nsew') txt['yscrollcommand'] = scrollb.set