-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.py
42 lines (33 loc) · 1.16 KB
/
view.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Huge shoutout to youtube user: sentdex at https://www.youtube.com/watch?v=jBUpjijYtCk which
# helped me figure out how to do multiple pages with tkinter
# Trisha Moyer
# Version 3.5
from tkinter import *
from addRecipe import AddARecipe
from mealPlan import MakeMealPlan
from landingpage import LandingPage
LARGE_FONT=("Verdana", 24)
MEDIUM_FONT=("Verdana", 12)
class main(Tk):
"""Main starting point of the app."""
def __init__(self, *args, **kwargs):
"""Initialize the main class"""
Tk.__init__(self, *args, **kwargs)
container = Frame(self)
container.pack(fill="both", expand=TRUE)
container.rowconfigure(0, weight=1)
container.columnconfigure(0, weight=1)
self.frames = {}
for my_frame in (LandingPage, AddARecipe, MakeMealPlan):
frame = my_frame(container, self)
self.frames[my_frame] = frame
frame.grid(row=0, column=0, sticky="nsew")
self.show_frame(LandingPage)
def show_frame(self, cont):
"""Show the frame"""
frame = self.frames[cont]
frame.tkraise()
app = main()
app.maxsize(900,600)
app.minsize(900,600)
app.mainloop()