Skip to content
Snippets Groups Projects
Commit f69b66f5 authored by Nijsen, T's avatar Nijsen, T
Browse files

Added a splash window at the start of the program. Currently only contains an...

Added a splash window at the start of the program. Currently only contains an image that probably needs some reworking.
parent 58e20493
No related branches found
No related tags found
2 merge requests!66Sc 155/splashwindow,!62Sc 155/splashwindow
umbra/Graphical elements/umbra_logo_v2.png

18.6 KiB

......@@ -5,15 +5,15 @@ import tkinter.filedialog as fd
import os
class Controller:
"""Control of general functionality and communication between Model
and View classes.
"""
def __init__(self, view, model):
def __init__(self, view, model, splash):
self._model = model
self._view = view
self._splash = splash
self._view.actionlistener = self.actionlistener
# Assume .csv only
......
from controller import Controller
from model import Model
from view import View
from view import View, SplashView
from tkinter import Tk
class Umbra:
"""Initialise seperate components of program."""
def __init__(self):
self._root = Tk()
self._root.withdraw()
self._splash = SplashView(self._root)
self._model = Model()
self._view = View()
self._controller = Controller(self._view, self._model)
self._view = View(self._root)
self._controller = Controller(self._view, self._model, self._splash)
def main(self):
"""Start the main loop."""
self._splash.terminate()
self._controller.start()
......
......@@ -4,13 +4,14 @@ from tkinter import ttk, W, filedialog # tk.ttk yields an AttributeError
from functools import partial
from utils import Utils as ut
import tkinter.filedialog as fd
from PIL import ImageTk, Image
class View:
"""Handle GUI and I/O elements of the program."""
def __init__(self):
self._window = tk.Tk()
def __init__(self, parent):
self._window = parent
self._window.wm_title("Umbra")
self._frame = tk.Frame(self._window).grid(column=0, row=0)
self._elements = {} # Dict to avoid large number of attributes
......@@ -49,6 +50,7 @@ class View:
def display(self):
"""Start main loop, displaying GUI elements."""
self._window.deiconify()
self._window.mainloop()
def select_files(self, file_type):
......@@ -339,3 +341,25 @@ class Options(View):
action_function = partial(self._view._perform_action, key=command)
tab.add_command(label=label)
tab.bind('<Button>', action_function)
class SplashView(tk.Toplevel):
"""A splash screen while the rest of the application is loading. """
def __init__(self, parent):
tk.Toplevel.__init__(self, parent)
self.grab_set()
self.title("Umbra")
self.iconbitmap("./Graphical elements/umbra_logo_v2.ico")
im_path = Image.open("./Graphical elements/umbra_logo_v2.png")
ph = ImageTk.PhotoImage(im_path)
load_img = tk.Label(self, image=ph)
load_img.grid(row=0, column=0)
lbl1 = tk.Label(self, text="Welcome to Umbra!", font='Timesnewroman 20 ', fg='blue')
lbl1.grid(row=1, column=0)
self.update()
def terminate(self):
self.destroy()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment