From 2563626def8c4b09c1b1a485dbf6c73b417ca296 Mon Sep 17 00:00:00 2001 From: Musab Erdem Date: Thu, 25 Jul 2024 16:39:55 +0200 Subject: [PATCH] =?UTF-8?q?Passwortschutz=20eingef=C3=BChrt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 11a1b75..79610ad 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,5 @@ import tkinter as tk -from tkinter import ttk, messagebox, PhotoImage +from tkinter import ttk, messagebox, PhotoImage, simpledialog import customtkinter customtkinter.set_appearance_mode("light") customtkinter.set_default_color_theme("blue") @@ -509,14 +509,20 @@ class ArduinoGUI: messagebox.showerror("Fehler", "Ausgewählte PID Konfiguration nicht gefunden.") def on_closing(self): - self.running = False - if self.arduino: - self.arduino.close() - self.communication_thread = None - if self.ser: - self.ser.close() - self.root.quit() - self.root.destroy() + userInput = simpledialog.askstring("Masterpasswort eingeben", "Zum Ausführen dieses Befehls ist das Masterpasswort notwendig.\n") + if userInput == "changeme": + self.running = False + if self.arduino: + self.arduino.close() + self.communication_thread = None + if self.ser: + self.ser.close() + self.root.quit() + self.root.destroy() + elif userInput == None: + pass + else: + messagebox.showerror("Fehler", "Es wurde ein falsches Passwort eingegeben.") if __name__ == "__main__": root = customtkinter.CTk()