Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions assets/lenght_image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -69,11 +70,16 @@ 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.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)
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.pack(side=tk.LEFT, padx=0, pady=5) ## newline


def ShowPass(self):
if self.showval:
Expand All @@ -86,8 +92,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):
Expand Down Expand Up @@ -144,4 +157,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()
root.mainloop()