import tkinter as tk
from tkinter import font as tkfont
class MenuBar(tk.Menu):
def __init__(self, parent, controller):
tk.Menu.__init__(self, controller)
self.controller = controller
fileMenu = tk.Menu(self, tearoff=0)
self.add_cascade(label="File", underline=0, menu=fileMenu)
fileMenu.add_command(label="New Test", underline=1, command=lambda: SampleApp().show_frame("NewTestWindow"))
fileMenu.add_separator()
fileMenu.add_command(label="Exit", underline=2, command=self.onexit)
def onexit(self):
quit()
class SampleApp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
self.title_font = tkfont.Font(family='Helvetica', size=18, weight="bold", slant="italic")
container = tk.Frame(self)
container.pack(side="top", fill="both", expand=True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
for F in (MainWindow, NewTestWindow):
page_name = F._