From 081759a4bbcf7d54b8693c461196cee63e0cbe95 Mon Sep 17 00:00:00 2001 From: Flavio0410 Date: Sat, 24 Dec 2022 15:42:03 +0100 Subject: [PATCH] main frame centered at the start --- gui/gui.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gui/gui.py b/gui/gui.py index 8ad3897..b49f143 100644 --- a/gui/gui.py +++ b/gui/gui.py @@ -5,6 +5,7 @@ from tkinter.messagebox import showinfo from tkinter import Listbox from image_slider import * +import tkinter from os import getcwd @@ -42,10 +43,17 @@ def delete_file(): window = Tk() - -window.geometry("800x600") +screen_width = window.winfo_screenwidth() # Width of the screen +screen_height = window.winfo_screenheight() # Height of the screen + +# Calculate Starting X and Y coordinates for Window +x = (screen_width/2) - (800/2) +y = (screen_height/2) - (600/2) + +window.geometry('%dx%d+%d+%d' % (800, 600, x, y)) # Set the window size and center in the screen window.configure(bg="#FFFFFF") + # Main frame main_frame = Canvas(master=window, bg="#FFFFFF", height=600, width=800, bd=0, highlightthickness=0, relief="ridge") @@ -103,5 +111,4 @@ def build(): window.title("Exposure fusions") window.mainloop() - build()