This repository has been archived on 2023-11-29. You can view files and clone it, but cannot push or open issues or pull requests.
WebPicDownloader/view/MainWindow.py

50 lines
1.2 KiB
Python
Raw Normal View History

from controller.MainController import MainController
import tkinter as tk
class MainWindow(tk.Tk):
"""
View - MainWindow
dec...
"""
# Variables
2022-08-30 13:51:50 +02:00
__controller: MainController = None
__views: dict = None
# Constructor
def __init__(self, controller: MainController):
super().__init__()
2022-08-30 13:51:50 +02:00
# Init view repository
self.__views = {}
# Init main window
2022-08-30 13:51:50 +02:00
self.title('Tkinter app')
self.geometry('450x250')
self.resizable(False, False)
# Save and setup main controller
2022-08-30 13:51:50 +02:00
self.__controller = controller
controller.set_view(self)
2022-08-30 13:51:50 +02:00
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):
2022-08-30 13:51:50 +02:00
"""
[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")