from controller.MainController import MainController
import tkinter as tk
class MainWindow(tk.Tk):
"""
View - MainWindow
dec...
# Variables
__controller: MainController = None
__views: dict = None
# Constructor
def __init__(self, controller: MainController):
super().__init__()
# Init view repository
self.__views = {}
# Init main window
self.title('Tkinter app')
self.geometry('450x250')
self.resizable(False, False)
# Save and setup main controller
self.__controller = controller
controller.set_view(self)
def add_view(self, frame, view):
[function for app]
:frame: -> the frame id of the view to add.
self.__views[frame] = view
def show_frame(self, frame):
[function for app & controller]
:frame: -> the frame if of the view to display.
print(self.__views)
if self.__views.get(frame):
self.__views.get(frame).tkraise()
#self.view = self.__views.get(frame)
#self.view.grid(row=0, column=0)
else:
raise ValueError("Unable to find the requested Frame")