Skip to content

Commit 52eb60c

Browse files
author
Programer043
authored
Fixd Bugs
i Fixed some bugs and i changed py to pyw for removing Console
1 parent b9d1bca commit 52eb60c

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

GUI PasswdGen V2.pyw

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
from tkinter import *
2+
from tkinter import messagebox
3+
import sys
4+
import random
5+
letters_full = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890123456789!#@$%&()*+-{}|~[]^_?!#@$%&()*+-{}|~[]^_?"
6+
upcase_full = "ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890123456789!#@$%&()*+-{}|~[]^_?!#@$%&()*+-{}|~[]^_?"
7+
lowcase_full = "abcdefghijklmnopqrstuvwxyz01234567890123456789!#@$%&()*+-{}|~[]^_?!#@$%&()*+-{}|~[]^_?"
8+
letters_with_symbol = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#@$%&()*+-{}|~[]^_?!#@$%&()*+-{}|~[]^_?"
9+
upcase_with_symbol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!#@$%&()*+-{}|~[]^_?!#@$%&()*+-{}|~[]^_?"
10+
lowcase_with_symbol = "abcdefghijklmnopqrstuvwxyz!#@$%&()*+-{}|~[]^_?!#@$%&()*+-{}|~[]^_?"
11+
letters_with_digits = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890123456789"
12+
upcase_with_digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890123456789"
13+
lowcase_with_digits = "abcdefghijklmnopqrstuvwxyz01234567890123456789"
14+
letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
15+
lowcase = "abcdefghijklmnopqrstuvwxyz"
16+
upcase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
17+
def Exit():
18+
sys.exit()
19+
def About():
20+
Root.attributes("-disabled",1)
21+
aboutwin = Tk()
22+
aboutwin.protocol("WM_DELETE_WINDOW",lambda:[Root.attributes("-disabled",0),
23+
aboutwin.destroy()])
24+
aboutwin.grab_set()
25+
aboutwin.title("About")
26+
aboutwin.geometry("234x85")
27+
aboutwin.resizable(False,False)
28+
Label(aboutwin,font=("Tahoma",10),text="A Simple Python Password Generator").place(x=5,y=0)
29+
text = Text(aboutwin,width=31,height=1,font=("Tahoma",10))
30+
text.insert(END,"Github: Github.com/Vahab-Programer")
31+
text.place(x=5,y=28)
32+
text2 = Text(aboutwin,width=31,height=1,font=("Tahoma",10))
33+
text2.insert(END,"Email: Vahabgamer.1390@Gmail.com")
34+
text2.place(x=5,y=56)
35+
def PasswdGen(Method):
36+
output.set("".join(random.choices(Method,k=lenght.get())))
37+
def Generate():
38+
output.set("")
39+
up = upp.get()
40+
lo = low.get()
41+
sm = smy.get()
42+
nu = num.get()
43+
if lenght.get() >= 8 and lenght.get() <=128:
44+
if up or lo :
45+
if up and lo and nu and sm:
46+
PasswdGen(letters_full)
47+
elif up and nu and sm and not lo:
48+
PasswdGen(upcase_full)
49+
elif lo and nu and sm and not up:
50+
PasswdGen(lowcase_full)
51+
elif up and lo and sm and not nu:
52+
PasswdGen(letters_with_symbol)
53+
elif up and sm and not lo and not nu:
54+
PasswdGen(upcase_with_symbol)
55+
elif lo and sm and not up and not nu:
56+
PasswdGen(lowcase_with_symbol)
57+
elif up and lo and nu and not sm:
58+
PasswdGen(letters_with_digits)
59+
elif up and nu and not lo and not sm:
60+
PasswdGen(upcase_with_digits)
61+
elif lo and nu and not up and not sm:
62+
PasswdGen(lowcase_with_digits)
63+
elif up and lo and not nu and not sm:
64+
PasswdGen(letters)
65+
elif up and not lo and not nu and not sm:
66+
PasswdGen(upcase)
67+
elif lo and not up and not nu and not sm:
68+
PasswdGen(lowcase)
69+
else:
70+
messagebox.showerror("Error","You need to select option!")
71+
else:
72+
messagebox.showerror("Error","You need to select Upper or Lower case Letters!")
73+
elif lenght.get() >= 129:
74+
messagebox.showerror("Error","Lenght cannot be Upper than 128")
75+
else:
76+
messagebox.showerror("Error","Lenght Cannot be Lower than 8")
77+
Root = Tk()
78+
Root.title("PasswdGen V2")
79+
Root.geometry("250x300")
80+
Root.resizable(False,False)
81+
menubar = Menu(Root)
82+
menubar.add_command(label="About",command=About)
83+
menubar.add_command(label="Exit",command=Exit)
84+
Root.config(menu=menubar)
85+
output = StringVar()
86+
upp = IntVar()
87+
low = IntVar()
88+
smy= IntVar()
89+
num= IntVar()
90+
lenght = IntVar()
91+
display = Entry(Root,textvariable=output,width=25,bd=10,background="blue",foreground="white").place(x=40,y=25)
92+
Label(Root,text="Options",font=("Tahoma",11)).place(x=100,y=75)
93+
Label(Root,text="Lenght",font=("Tahoma",12)).place(x=55,y=195)
94+
Checkbutton(Root,text="Upper Case",font=("Tahoma",10),variable=upp,onvalue=1,offvalue=0).place(x=35,y=100)
95+
Checkbutton(Root,text="Lower Case",font=("Tahoma",10),variable=low,onvalue=1,offvalue=0).place(x=135,y=100)
96+
Checkbutton(Root,text="Symbols",font=("Tahoma",10),variable=smy,onvalue=1,offvalue=0).place(x=35,y=150)
97+
Checkbutton(Root,text="Numbers",font=("Tahoma",10),variable=num,onvalue=1,offvalue=0).place(x=135,y=150)
98+
Lenght = Spinbox(Root,textvariable=lenght,from_=8,to=128,width=12,).place(x=130,y=200)
99+
Button(Root,text="Generate",width=18,font=("Tahoma",13),command=Generate).place(x=40,y=250)
100+
Root.mainloop()

0 commit comments

Comments
 (0)