Skip to content

Commit 49e0236

Browse files
author
Programer043
authored
Add files via upload
1 parent c621ce9 commit 49e0236

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

GUI PasswdGen V2.py

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

0 commit comments

Comments
 (0)