From 4e10ed66862f88193e6e3ad0ce2b76976a87e7a9 Mon Sep 17 00:00:00 2001 From: Freezer-tech <54477347+Freezer-tech@users.noreply.github.com> Date: Thu, 28 Sep 2023 12:13:20 +0200 Subject: [PATCH 1/3] length image Added the length image --- assets/lenght_image.svg | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 assets/lenght_image.svg diff --git a/assets/lenght_image.svg b/assets/lenght_image.svg new file mode 100644 index 0000000..a950c7d --- /dev/null +++ b/assets/lenght_image.svg @@ -0,0 +1,6 @@ + + + + + From 2dfdfc00cd4a50feae68266a3256e4c02a8d64a6 Mon Sep 17 00:00:00 2001 From: Freezer-tech <54477347+Freezer-tech@users.noreply.github.com> Date: Thu, 28 Sep 2023 12:18:07 +0200 Subject: [PATCH 2/3] User can choose password lenght Now user can choose the lenght of the password directly --- main.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 8dec2b4..49ea967 100644 --- a/main.py +++ b/main.py @@ -31,6 +31,7 @@ def makeWidgets(self): self.upper_image = self.load_image("/assets/upper_image.svg") self.number_image = self.load_image("/assets/number_image.svg") self.special_image = self.load_image("/assets/special_image.svg") + self.lenght_image = self.load_image("/assets/lenght_image.svg") #newline self.showeye_image = self.load_image("/assets/showeye_image.svg") self.hideeye_image = self.load_image("/assets/hideeye_image.svg") @@ -69,11 +70,17 @@ def makeWidgets(self): self.upperc = customtkinter.CTkButton(self.f, text=None, image=self.upper_image, fg_color="#181A1B", state="disabled", width=30, height=30) self.numberc = customtkinter.CTkButton(self.f, text=None, image=self.number_image, fg_color="#181A1B", state="disabled", width=30, height=30) self.specialc = customtkinter.CTkButton(self.f, text=None, image=self.special_image, fg_color="#181A1B", state="disabled", width=30, height=30) + self.lenght = customtkinter.CTkButton(self.f, text=None, image=self.lenght_image, fg_color="#181A1B", state="disabled", width=30, height=30) self.lowerc.pack(side=tk.LEFT, padx=10, pady=2) self.upperc.pack(side=tk.LEFT, padx=10, pady=2) self.numberc.pack(side=tk.LEFT, padx=10, pady=2) self.specialc.pack(side=tk.LEFT, padx=10, pady=2) + self.lenght.pack(side=tk.LEFT, padx=10, pady=2) ## newline + + self.length_entry = customtkinter.CTkEntry(self.f, justify='center', text_color="#DDE6E8", width=10, text_font=("Segoe UI", 9, "bold")) ## newline + self.length_entry.pack(side=tk.LEFT, padx=0, pady=5) ## newline + def ShowPass(self): if self.showval: @@ -86,8 +93,15 @@ def ShowPass(self): self.passEntry.configure(show="*") def RandomPass(self): + length_str = self.length_entry.get() + try: + length = int(length_str) + except ValueError: + # Gestire il caso in cui l'input non sia un numero intero valido + return + alphabet = string.ascii_letters + string.digits + "@$!%*?&" - password = "".join(secrets.choice(alphabet) for _ in range(8)) + password = "".join(secrets.choice(alphabet) for _ in range(length)) self.passstr.set(password) def _update(self, *args): @@ -144,4 +158,4 @@ def load_image(self, path): #GlobalBlur(ctypes.windll.user32.GetForegroundWindow(),hexColor="#1f1f1f00",Acrylic = True) #root.protocol('WM_DELETE_WINDOW', PassCheck().hide_window) PassCheck(root).pack() - root.mainloop() \ No newline at end of file + root.mainloop() From 3fda377f3aec98a58f970bae4c0f6a609af553f5 Mon Sep 17 00:00:00 2001 From: Freezer-tech <54477347+Freezer-tech@users.noreply.github.com> Date: Thu, 28 Sep 2023 13:59:17 +0200 Subject: [PATCH 3/3] Update main.py little change on self.lenght due to different size with other widget --- main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.py b/main.py index 49ea967..74e7e6f 100644 --- a/main.py +++ b/main.py @@ -70,7 +70,7 @@ def makeWidgets(self): self.upperc = customtkinter.CTkButton(self.f, text=None, image=self.upper_image, fg_color="#181A1B", state="disabled", width=30, height=30) self.numberc = customtkinter.CTkButton(self.f, text=None, image=self.number_image, fg_color="#181A1B", state="disabled", width=30, height=30) self.specialc = customtkinter.CTkButton(self.f, text=None, image=self.special_image, fg_color="#181A1B", state="disabled", width=30, height=30) - self.lenght = customtkinter.CTkButton(self.f, text=None, image=self.lenght_image, fg_color="#181A1B", state="disabled", width=30, height=30) + self.length_entry = customtkinter.CTkEntry(self.f, justify='center', fg_color="#181A1B",text_color="#DDE6E8", width=31, height=31, text_font=("Segoe UI", 9, "bold")) self.lowerc.pack(side=tk.LEFT, padx=10, pady=2) self.upperc.pack(side=tk.LEFT, padx=10, pady=2) @@ -78,7 +78,6 @@ def makeWidgets(self): self.specialc.pack(side=tk.LEFT, padx=10, pady=2) self.lenght.pack(side=tk.LEFT, padx=10, pady=2) ## newline - self.length_entry = customtkinter.CTkEntry(self.f, justify='center', text_color="#DDE6E8", width=10, text_font=("Segoe UI", 9, "bold")) ## newline self.length_entry.pack(side=tk.LEFT, padx=0, pady=5) ## newline