This repository has been archived by the owner on Mar 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
homepageUI.py
110 lines (83 loc) · 4.07 KB
/
homepageUI.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
from tkinter import *
from frameSignaler import FrameSignaler
class HomepageUI:
@classmethod
def addFrame(self, window, fsObj):
#This method adds the screen to the window from UIManager.
def frameMaker(display = False):
if display:
# initialize home page window
home_page = Frame(window, width = 800, height = 600, bg = "white")
# create frame for options
page_frame = Frame(home_page, bg = "white")
#Banner
bfObj = Frame(window, width = 800, height = 94, bg= "white")
banner = PhotoImage(file = "BannerResources/Bhomepage.gif")
bannerLabel = Label(bfObj, image = banner)
bannerLabel.image = banner
bfObj.place(x = 0, y = 0)
bannerLabel.pack(fill = "both")
# callbacks
def destroyScreen():
for widget in window.winfo_children():
widget.destroy()
def createCSheet():
destroyScreen()
fsObj.setFlag("createCSheetUI")
fsObj.setData("")
def selectCSheet():
destroyScreen()
fsObj.setFlag("selectCSheetUI")
fsObj.setData("")
def feedback():
destroyScreen()
fsObj.setFlag("feedbackUI")
fsObj.setData("")
#load icon photos
faq_image = PhotoImage(file="ThemeResources/FAQ.png")
create_image = PhotoImage(file="ThemeResources/Create.png")
select_image = PhotoImage(file="ThemeResources/Select.png")
backArrow_image = PhotoImage(file="ThemeResources/BackArrow.png")
# create options buttons for frame
create_page = Button(page_frame, text="Create", width="250", image = create_image, compound=LEFT, command = createCSheet, borderwidth = 2)
create_page.image = create_image
select_page = Button(page_frame, text="Select", width="250", image = select_image, compound=LEFT, command = selectCSheet, borderwidth = 2)
select_page.image = select_image
create_page.pack(pady=20)
select_page.pack()
page_frame.place(anchor="s")
page_frame.pack(padx=5, pady=20)
# create feedback button
feedback_button = Button(page_frame, text="?", image = faq_image, height = 25, width = 25, command = feedback, borderwidth = 2,)
feedback_button.image = faq_image
feedback_button.pack(anchor="w", padx=0, pady=(25, 0))
#Grid.rowconfigure(option_frame, 0, weight=1)
#Grid.columnconfigure(option_frame, 0, weight=1)
#create_page.grid(row=0, column=0, sticky="NSEW")
#select_page.grid(row=1, column=0, sticky="NSEW")
#create_page.grid # Should this line be here?
page_frame.place(in_=home_page, anchor="c", relx=0.5, rely=0.5)
home_page.pack()
#Decal
#load decal photos
dHomepage = PhotoImage(file = "DecalResources/Dhomepage.png")
dLabel = Label(home_page, image = dHomepage, height = 297, width = 197, bd = 0)
dLabel.image = dHomepage
dLabel.place(x = 600, y = 300)
frameMaker(True)
return ["homepageUI", frameMaker]
@classmethod
def testFrame(self):
#This method is for testing the screen by itself
window = Tk()
window.geometry("800x600")
fsObj = FrameSignaler
self.addFrame(window, fsObj)
def printFrameSignaler():
print(fsObj.getFlag())
print(fsObj.getData())
window.after(1000, printFrameSignaler)
printFrameSignaler()
window.mainloop()
if __name__ == "__main__":
HomepageUI.testFrame()