-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_interface.py
More file actions
56 lines (49 loc) · 1.87 KB
/
main_interface.py
File metadata and controls
56 lines (49 loc) · 1.87 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
'''
This file shows the opening interface.
The interface class is created to state the welcome message and set the geometry of the interface.
'''
# Third party imports
import tkinter as tk
from admin_interface import AdminFrame
from learner_interface import LearnerFrame
# Local application imports
from login_interface import LoginFrame
from teacher_interface import TeacherFrame
#Class for opening interface, sets geometry
class Interface(tk.Tk):
"""
Class definition for the Interface class
"""
def __init__(self, title, width=960, height=540):
"""
Constructor for the Interface class,
the main window for the HCMS.
:param title: str
:param width: int - default 960 pixels
:param height: int - default 540 pixels
"""
self.width = width
self.height = height
super().__init__()
self.title(title)
self.geometry(f"{width}x{height}") # Set the window geometry
self.login_frame = LoginFrame(self)
self.admin_frame = AdminFrame(self,self.login_frame)
self.learner_frame = LearnerFrame(self)
self.teacher_frame = TeacherFrame(self)
self.login_frame.place(relx=0.5, rely=0.5, anchor=tk.CENTER)
self.login_frame.master = self
def run(self):
self.mainloop()
def show_login_frame(self):
self.admin_frame.pack_forget() # Hide the admin frame if it's visible
self.learner_frame.pack_forget()
self.teacher_frame.pack_forget()
self.login_frame.place(relx=0.5, rely=0.5, anchor=tk.CENTER)
#Sets the text that is displayed and where
if __name__ == "__main__":
codeventure = Interface("Welcome to the CodeVenture Learning Program")
#login = LoginFrame(codeventure)
#login.place(relx=0.5, rely=0.5, anchor=tk.CENTER)
codeventure.run()
print("--- End of program execution ---")