-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlanPeriod.py
More file actions
43 lines (37 loc) · 1.72 KB
/
Copy pathPlanPeriod.py
File metadata and controls
43 lines (37 loc) · 1.72 KB
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
43
"""
This class creates an interface for user to input the period for planning meal
"""
import tkinter as tk
from tkinter import ttk
TITLEFONT = ("Time New Roman", 15)
class PlanPeriod(tk.Frame):
def __init__(self, parent, main_view):
tk.Frame.__init__(self, parent)
parent = tk.Frame(self, bg = "white")
# the title of the frame
title = tk.Label(parent,text = "Set plan period", font = TITLEFONT,
bg = "white")
# the combobox
valuelist = ["Weekly"]
self.plan_period = tk.StringVar()
combo_box = ttk.Combobox(parent, width = 15, values = valuelist,
textvariable = self.plan_period)
combo_box.current(0)
#the back & next buttons
backbtn = tk.Button(parent, text = "Back", bg = "Green", relief = "flat",
command = lambda : main_view.show_frame(main_view.frame_UserDefinedMeal))
savebtn = tk.Button(parent, text ="Save", bg = "Green", relief = "flat",
command = lambda : self.save_database(main_view))
# make all elements visible by using grid
parent.grid(column = 0, row = 0)
title.grid(column = 0, row = 0, columnspan = 3, pady = 10)
combo_box.grid (column = 1, row = 2, pady = 30)
backbtn.grid(column = 0, row = 3, padx = 15, pady = 10)
savebtn.grid(column = 2, row = 3, padx = 15, pady = 10)
def save_database(self, main_view):
main_view.controller.save_user_info(main_view.user_info)
#print(main_view.user_info)
#print(main_view.user_defined_meal)
print(main_view.controller.get_user_info())
main_view.controller.save_user_defined_meal(main_view.user_defined_meal)
print(main_view.controller.get_user_defined_meal())