33 lines
970 B
Python
33 lines
970 B
Python
import tkinter as tk
|
|
from app.views.login import LoginView
|
|
from app.views.initial import InitialView
|
|
from app.views.signup import SignupView
|
|
|
|
|
|
class MainApplication(tk.Tk):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
self.title("Messenger App")
|
|
|
|
screen_height = self.winfo_screenheight()
|
|
self.geometry(f"{screen_height // 2}x{screen_height // 2}")
|
|
|
|
# Create instances of the views
|
|
self.login_view = LoginView(self)
|
|
self.initial_view = InitialView(self)
|
|
self.signup_view = SignupView(self)
|
|
self.main_view = tk.Label(self, text="Main View")
|
|
|
|
self.current_view = None
|
|
self.change_view(self.initial_view)
|
|
|
|
def change_view(self, view: tk.Frame):
|
|
if self.current_view:
|
|
self.current_view.pack_forget()
|
|
|
|
self.current_view = view
|
|
self.current_view.pack(expand=True, fill=tk.BOTH)
|
|
self.current_view.place(relx=0.5, rely=0.5, anchor=tk.CENTER)
|
|
|