From a172bcd8a58f23ecec5e51f2185e0e7cdb85c5c6 Mon Sep 17 00:00:00 2001 From: kromskii2 <146603192+kromskii2@users.noreply.github.com> Date: Mon, 25 Mar 2024 20:38:40 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20=D1=81=20?= =?UTF-8?q?=D0=BB=D0=B8=D1=86=D0=B5=D0=BD=D0=B7=D0=B8=D0=B5=D0=B9=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=B7=D1=8B=D0=B2=D0=B0=D1=8E=D1=89=D0=B0=D1=8F=20=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Menu.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Menu.py b/Menu.py index 22a7f95..fb7c7a5 100644 --- a/Menu.py +++ b/Menu.py @@ -1,6 +1,8 @@ import tkinter as tk import webbrowser import time +import asyncio +import subprocess class RoundedMenuApp: def __init__(self, width, height, corner_radius): @@ -9,7 +11,7 @@ class RoundedMenuApp: self.corner_radius = corner_radius self.root = tk.Tk() - self.root.title("Klajer") # Изменено название приложения + self.root.title("Klajer") # Changed the title of the application # Get the screen width and height screen_width = self.root.winfo_screenwidth() @@ -26,12 +28,13 @@ class RoundedMenuApp: self.draw_rounded_corners() self.create_youtube_button() + self.create_license_button() # Added the license button - # Создаем метку для отображения времени + # Create a label to display the time self.time_label = tk.Label(self.root, text="", font=("Arial", 12)) self.time_label.place(relx=0.5, rely=1, anchor="s") - # Запускаем обновление времени + # Start updating time self.update_time() def draw_rounded_corners(self): @@ -51,18 +54,28 @@ class RoundedMenuApp: youtube_button = tk.Button(self.root, text="YouTube", command=self.open_youtube) youtube_button.place(relx=1, rely=1, anchor="se") + def create_license_button(self): + license_button = tk.Button(self.root, text="License", command=self.open_license) + license_button.place(relx=0, rely=1, anchor="sw") + + async def async_open_license(self): + await asyncio.create_subprocess_exec('python', 'License-agreement.py') + + def open_license(self): + asyncio.run(self.async_open_license()) # Run the async function in a synchronous context + def open_youtube(self): webbrowser.open_new_tab("https://www.youtube.com/") def update_time(self): current_time = time.strftime("%H:%M:%S") self.time_label.config(text=current_time) - self.root.after(1000, self.update_time) # Обновляем время каждую секунду + self.root.after(1000, self.update_time) # Update time every second def run(self): self.root.mainloop() -# Создаем и запускаем приложение +# Create and run the application app = RoundedMenuApp(width=646, height=396, corner_radius=30) app.run()