-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
297 lines (219 loc) · 12.1 KB
/
main.py
File metadata and controls
297 lines (219 loc) · 12.1 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
"""
A module that contains the code to run the project
Uncomment each part to run each section of the project.
Synopsis:
Part 1: Graphs the line graph of both pre-pandemic(2021) and during pandemic (2020)
based on the chosen industry.
Part 2: Creates a table on the difference in percentage and floats based on the chosen
industries and time period.
Part 3: Creates a table based on the yearly average working hours for the chosen industry.
"""
import matplotlib
from tkinter import *
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import project_part_1 as proj1
import project_part_2 as proj2
import project_part_3 as proj3
matplotlib.use('TkAgg')
########
# Part 1
########
# root = Tk()
# root.overrideredirect(True)
# root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight()))
# root.config(bg='#73C2FB')
# # Displays the window in full screen and set the background color
# frame = Frame(root)
# frame.pack()
# frame.config(bg='#73C2FB')
# middleframe = Frame(root)
# bottomframe = Frame(root)
# bottomframe.pack(side=LEFT)
# canvas = None
# # Buttons:
# button_of_agriculture = Button(frame, text="Agriculture",
# command=lambda: display("Agriculture"), padx=15, bg='light blue')
# button_of_agriculture.grid(row=0, column=0) # Placing the buttons on the screen
# button_of_FFMQOG = Button(frame, text="Forestry, fishing, mining, quarrying, oil and gas",
# command=lambda: display("Forestry, fishing, mining, quarrying, oil and gas"), padx=15,
# bg='light blue')
# button_of_FFMQOG.grid(row=0, column=1)
# button_of_construction = Button(frame, text="Construction",
# command=lambda: display("Construction"), padx=15, bg='light blue')
# button_of_construction.grid(row=0, column=2)
# button_of_wholesale = Button(frame, text="Wholesale and retail trade",
# command=lambda: display("Wholesale and retail trade"), padx=15, bg='light blue')
# button_of_wholesale.grid(row=0, column=3)
# button_of_transportation_and_warehousing = Button(frame, text="Transportation and warehousing",
# command=lambda: display("Transportation and warehousing"), padx=15,
# bg='light blue')
# button_of_transportation_and_warehousing.grid(row=0, column=4)
# button_of_edicational_services = Button(frame, text="Education",
# command=lambda: display("Educational services"), padx=15, bg='light blue')
# button_of_edicational_services.grid(row=0, column=5)
# button_of_health_care = Button(frame, text="Health care and social assistance",
# command=lambda: display("Health care and social assistance"), padx=15, bg='light blue')
# button_of_health_care.grid(row=0, column=6)
# button_of_accomodation_and_food = Button(frame, text="Accomodation and food services",
# command=lambda: display("Accommodation and food services"), padx=15,
# bg='light blue')
# button_of_accomodation_and_food.grid(row=0, column=7)
# button_of_public_administration = Button(frame, text="Public administration",
# command=lambda: display("Public administration"), padx=15, bg='light blue')
# button_of_public_administration.grid(row=0, column=8)
# quit_button = Button(frame, text="Close the program", command=root.destroy, bg='light yellow') # The quit button
# quit_button.grid(row=10, column=4)
# def display(industry: str) -> None:
# """
# Display the graph of the industry on the user panel.
# """
# global canvas, bottomframe
# if canvas: # Removing the existing graph (if there is any)
# bottomframe.destroy()
# bottomframe = Frame(root)
# bottomframe.pack(side=BOTTOM)
# # Generating the figure and a canvas to display it
# figure = proj1.plotting_the_graph(industry)
# canvas = FigureCanvasTkAgg(figure, master=bottomframe)
# canvas.get_tk_widget().pack(side=BOTTOM, fill=BOTH, expand=True) # Displaying the figure
# root.mainloop()
# ######
# Part 2
# ######
# root = Tk()
# root.overrideredirect(True)
# root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight()))
# root.config(bg='#73C2FB')
# frame = Frame(root)
# frame.pack()
# frame.config(bg='#73C2FB')
# bottomframe = Frame(root)
# bottomframe.pack(side=BOTTOM)
# canvas = None
# button_of_agriculture = Button(frame, text="Agriculture",
# command=lambda: dropdown_menu("Agriculture"), padx=15, bg='light blue')
# button_of_agriculture.grid(row=0, column=0) # Placing the buttons on the screen
# button_of_FFMQOG = Button(frame, text="Forestry, Fishing, Mining, Quarrying, Oil and Gas",
# command=lambda: dropdown_menu("Forestry, fishing, mining, quarrying, oil and gas"),
# padx=15, bg='light blue')
# button_of_FFMQOG.grid(row=0, column=1)
# button_of_construction = Button(frame, text="Construction",
# command=lambda: dropdown_menu("Construction"), padx=15, bg='light blue')
# button_of_construction.grid(row=0, column=2)
# button_of_wholesale = Button(frame, text="Wholesale and Retail Trade",
# command=lambda: dropdown_menu("Wholesale and retail trade"), padx=15, bg='light blue')
# button_of_wholesale.grid(row=0, column=3)
# button_of_transportation_and_warehousing = Button(frame, text="Transportation and Warehousing",
# command=lambda: dropdown_menu("Transportation and warehousing"),
# padx=15, bg='light blue')
# button_of_transportation_and_warehousing.grid(row=0, column=4)
# button_of_edicational_services = Button(frame, text="Education",
# command=lambda: dropdown_menu('Educational services'),
# padx=15, bg='light blue')
# button_of_edicational_services.grid(row=0, column=5)
# button_of_health_care = Button(frame, text="Health Care and Social Assistance",
# command=lambda: dropdown_menu("Health care and social assistance",),
# padx=15, bg='light blue')
# button_of_health_care.grid(row=0, column=6)
# button_of_accomodation_and_food = Button(frame, text="Accommodation and Food Services",
# command=lambda: dropdown_menu("Accommodation and food services"),
# padx=15, bg='light blue')
# button_of_accomodation_and_food.grid(row=0, column=7)
# button_of_public_administration = Button(frame, text="Public Administration",
# command=lambda: dropdown_menu("Public administration"),
# padx=15, bg='light blue')
# button_of_public_administration.grid(row=0, column=8)
# quit_button = Button(frame, text="Close the program", command=lambda: root.destroy(), bg='light yellow')
# quit_button.grid(row=3, column=4)
# # The quit button
# execute_button = Button(frame, text="Draw the table", command=lambda: display_graph(industry_name, clicked_var.get()))
# execute_button.grid(row=2, column=4, pady=20)
# industry_name = ''
# def dropdown_menu(industry: str) -> None:
# """
# Display a dropdown menu to select options from.
# """
# global clicked_var, industry_name
# industry_name = ''
# # These are the options on the dropdown menu
# options = ["January 2019- 20", "February 2019- 20", "March 2019- 20",
# "April 2019- 20", "May 2019- 20", "June 2019- 20",
# "July 2019- 20", "August 2019- 20", "September 2019- 20",
# "October 2019- 20", "November 2019- 20", "Decemeber 2019- 20"]
# clicked_var = StringVar() # A string variable container
# clicked_var.set("Select a value") # Default value
# menu = OptionMenu(frame, clicked_var, *options)
# menu.grid(row=1, column=4, pady=20)
# menu.config(bg='cyan', width=30, height=1)
# industry_name = industry
# def display_graph(industry: str, timeframe: str) -> None:
# """
# Display the necessary DataFrame on the screen as table.
# """
# global canvas, bottomframe
# if canvas: # Removing the existing graph (if there is any)
# bottomframe.destroy()
# bottomframe = Frame(root)
# bottomframe.pack(side=BOTTOM)
# # Generating the figure and a canvas to display it
# figure = proj2.create_table(industry, timeframe)
# canvas = FigureCanvasTkAgg(figure, master=bottomframe)
# canvas.get_tk_widget().pack(side=BOTTOM, fill=BOTH, expand=True) # Displaying the figure
# root.mainloop()
#########
# Part 3
#########
# root = Tk()
# root.overrideredirect(True)
# root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight()))
# root.config(bg='#73C2FB')
# frame = Frame(root)
# frame.pack()
# frame.config(bg='#73C2FB')
# bottomframe = Frame(root)
# bottomframe.pack(side=LEFT)
# canvas = None
# button_of_agriculture = Button(frame, text="Agriculture",
# command=lambda: display_dataframe("Agriculture"))
# button_of_agriculture.grid(row=0, column=0) # Placing the buttons on the screen
# button_of_FFMQOG = Button(frame, text="Forestry, Fishing, Mining, Quarrying, Oil and Gas",
# command=lambda: display_dataframe("Forestry, fishing, mining, quarrying, oil and gas"))
# button_of_FFMQOG.grid(row=0, column=1)
# button_of_construction = Button(frame, text="Construction",
# command=lambda: display_dataframe("Construction"))
# button_of_construction.grid(row=0, column=2)
# button_of_wholesale = Button(frame, text="Wholesale and Retail Trade",
# command=lambda: display_dataframe("Wholesale and retail trade"))
# button_of_wholesale.grid(row=0, column=3)
# button_of_transportation_and_warehousing = Button(frame, text="Transportation and Warehousing",
# command=lambda: display_dataframe("Transportation and warehousing"))
# button_of_transportation_and_warehousing.grid(row=0, column=4)
# button_of_edicational_services = Button(frame, text="Education",
# command=lambda: display_dataframe("Educational services"))
# button_of_edicational_services.grid(row=0, column=5)
# button_of_health_care = Button(frame, text="Health Care and Social Assistance",
# command=lambda: display_dataframe("Health care and social assistance"))
# button_of_health_care.grid(row=0, column=6)
# button_of_accomodation_and_food = Button(frame, text="Accommodation and Food Services",
# command=lambda: display_dataframe("Accommodation and food services"))
# button_of_accomodation_and_food.grid(row=0, column=7)
# button_of_public_administration = Button(frame, text="Public Administration",
# command=lambda: display_dataframe("Public administration"))
# button_of_public_administration.grid(row=0, column=8)
# quit_button = Button(frame, text="Close the program", command=lambda: root.destroy(), bg='light yellow')
# quit_button.grid(row=3, column=4)
# # The quit button
# def display_dataframe(industry: str) -> None:
# """
# Display the DataFrame to the tkinter window, depending on which button was pressed
# """
# global canvas, bottomframe
# if canvas: # Removing the existing graph (if there is any)
# bottomframe.destroy()
# bottomframe = Frame(root)
# bottomframe.pack(side=BOTTOM)
# # Generating the figure and a canvas to display it
# figure = proj3.create_table(industry)
# canvas = FigureCanvasTkAgg(figure, master=bottomframe)
# canvas.get_tk_widget().pack(side=BOTTOM, fill=BOTH, expand=True) # Displaying the figure
# root.mainloop()