diff --git a/Menu.py b/Menu.py index 5a1a811..069e6ac 100644 --- a/Menu.py +++ b/Menu.py @@ -9,13 +9,22 @@ class RoundedMenuApp: self.root = tk.Tk() self.root.title("Rounded Menu") - self.root.geometry(f"{width}x{height}") + + # Get the screen width and height + screen_width = self.root.winfo_screenwidth() + screen_height = self.root.winfo_screenheight() + + # Calculate x and y position for the Tk root window + x = (screen_width / 2) - (width / 2) + y = (screen_height / 2) - (height / 2) + + self.root.geometry(f"{width}x{height}+{int(x)}+{int(y)}") # Set geometry with position self.canvas = tk.Canvas(self.root, width=width, height=height, bg="white", highlightthickness=0) self.canvas.pack() self.draw_rounded_corners() - self.create_youtube_button() # Создание кнопки YouTube + self.create_youtube_button() def draw_rounded_corners(self): x0, y0 = 0, 0 @@ -35,12 +44,12 @@ class RoundedMenuApp: youtube_button.place(relx=1, rely=1, anchor="se") def open_youtube(self): - webbrowser.open_new_tab("https://www.youtube.com/") # Открыть ссылку в браузере в новой вкладке + webbrowser.open_new_tab("https://www.youtube.com/") def run(self): self.root.mainloop() -# Создание и запуск приложения +# Create and run the application app = RoundedMenuApp(width=646, height=396, corner_radius=30) app.run()