Open program in the center of the window at launch
This commit is contained in:
@@ -8,14 +8,14 @@ from view.MainWindow import MainWindow
|
||||
|
||||
class InfoView(ttk.Frame):
|
||||
"""
|
||||
View - MainWindow
|
||||
View - InfoWindow
|
||||
|
||||
dec...
|
||||
This view displays information about the program, as well as its version and release date.
|
||||
|
||||
@author Jérémi Nihart / EndMove
|
||||
@link https://git.endmove.eu/EndMove/WebPicDownloader
|
||||
@version 1.0.0
|
||||
@since 2022-08-30
|
||||
@since 2022-09-06
|
||||
"""
|
||||
# Variables
|
||||
__controller: InfoController = None
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import os
|
||||
import sys
|
||||
import tkinter as tk
|
||||
from tkinter import messagebox
|
||||
from controller.Frames import Frames
|
||||
@@ -50,11 +48,13 @@ class MainWindow(tk.Tk):
|
||||
[internal function]
|
||||
=> Initialize window parameters
|
||||
"""
|
||||
# self.title('My tkinter app')
|
||||
self.geometry('430x310')
|
||||
self.resizable(False, False)
|
||||
self.iconbitmap(f"{self.__controller.get_config('sys_directory')}\\assets\logo.ico")
|
||||
# self.config(bg='#f7ef38')
|
||||
self.iconbitmap(f"{self.__controller.get_config('sys_directory')}\\assets\logo.ico") # App logo
|
||||
window_width = 430 # App width
|
||||
window_height = 305 # App height
|
||||
x_cordinate = int((self.winfo_screenwidth()/2) - (window_width/2))
|
||||
y_cordinate = int((self.winfo_screenheight()/2) - (window_height/2))
|
||||
self.geometry(f"{window_width}x{window_height}+{x_cordinate}+{y_cordinate}") # App size and middle centering
|
||||
self.resizable(False, False) # Disable app resizing
|
||||
|
||||
def __init_top_menu(self) -> None:
|
||||
"""
|
||||
@@ -63,12 +63,14 @@ class MainWindow(tk.Tk):
|
||||
"""
|
||||
main_menu = tk.Menu(self)
|
||||
|
||||
# Top menu File item
|
||||
col1_menu = tk.Menu(main_menu, tearoff=0)
|
||||
col1_menu.add_command(label="Open app folder", command=self.__controller.on_open_folder)
|
||||
col1_menu.add_separator()
|
||||
col1_menu.add_command(label="Quit", command=self.__controller.on_quite)
|
||||
main_menu.add_cascade(label="File", menu=col1_menu)
|
||||
|
||||
# Top menu Help item
|
||||
col2_menu = tk.Menu(main_menu, tearoff=0)
|
||||
col2_menu.add_command(label="Check for update", command=self.__controller.on_check_for_update)
|
||||
col2_menu.add_command(label="About", command=self.__controller.on_about)
|
||||
@@ -139,7 +141,7 @@ class MainWindow(tk.Tk):
|
||||
"""
|
||||
return True if (messagebox.askquestion(title, message, icon=icon) == "yes") else False
|
||||
|
||||
def show_information_dialog(self, title: str, message: str, icon: str='information') -> None:
|
||||
def show_information_dialog(self, title: str, message: str, icon: str='info') -> None:
|
||||
"""
|
||||
[function for controller]
|
||||
=> Display an information dialog to the user.
|
||||
@@ -148,5 +150,5 @@ class MainWindow(tk.Tk):
|
||||
* :message: -> Message of the dialogue displayed to the user.
|
||||
* :icon: -> Icon of the dialogue displayed to the user.
|
||||
"""
|
||||
messagebox.showinfo(self, title, message, icon=icon)
|
||||
messagebox.showinfo(title, message, icon=icon)
|
||||
# END Controller methods
|
||||
|
||||
Reference in New Issue
Block a user