fix: position the window to the centre of screen

This commit is contained in:
Dan Anglin 2024-02-12 21:30:27 +00:00
parent ccdffe00bf
commit 340eec773d
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638

View file

@ -42,6 +42,13 @@ class Window:
self.__root.title("Maze Solver")
self.__root.protocol("WM_DELETE_WINDOW", self.close)
# Position the window to the centre of the screen
screen_width = self.__root.winfo_screenwidth()
screen_height = self.__root.winfo_screenheight()
centre_x = int(screen_width/2 - width/2)
centre_y = int(screen_height/2 - height/2)
self.__root.geometry(f"{width}x{height}+{centre_x}+{centre_y}")
self.__canvas = Canvas(self.__root)
self.__canvas.config(
bg="white",