-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPassGen.py
60 lines (45 loc) · 1.88 KB
/
PassGen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from tkinter import *
import string
import random
def generator():
passwordField.delete(0,END)
sa=string.ascii_lowercase
ca=string.ascii_uppercase
ns=string.digits
sc=string.punctuation
all=sa+ca+ns+sc
pl=int(length_Box.get())
if choice.get()==1:
passwordField.insert(0,random.sample(sa+ca,pl))
if choice.get()==2:
passwordField.insert(0,random.sample(sa+ca+ns,pl))
if choice.get()==3:
passwordField.insert(0,random.sample(all,pl))
if choice.get()==0:
passwordField.insert(0,"Enter Strength")
root=Tk()
root.config(bg='deep pink')
root.title('Password Generator')
root.geometry('300x400')
choice=IntVar()
value=0
Font=('arial',13,'bold')
passwordLabel=Label(root,text='Password Generator',font=('times new roman',20,'bold'),bg='deep pink',fg='grey1')
passwordLabel.grid(pady=10)
passwordLabel=Label(root,text='Password Strength',font=Font,bg='deep pink',fg='grey1')
passwordLabel.grid(pady=10)
weakradioButton=Radiobutton(root,text='Weak',value=1,variable=choice,font=Font,bg='hot pink',activebackground='deep pink')
weakradioButton.grid(pady=5)
mediumradioButton=Radiobutton(root,text='Medium',value=2,variable=choice,font=Font,bg='hot pink',activebackground='deep pink')
mediumradioButton.grid(pady=5)
strongradioButton=Radiobutton(root,text='Strong',value=3,variable=choice,font=Font,bg='hot pink',activebackground='deep pink')
strongradioButton.grid(pady=5)
lengthLabel=Label(root,text='Password Length',font=Font,bg='deep pink',fg='grey1')
lengthLabel.grid(pady=5)
length_Box=Spinbox(root,from_=5,to_=18,width=5,font=Font)
length_Box.grid(pady=5)
generateButton=Button(root,text='Generate',font=Font,command=generator,bg='hot pink',activebackground='deep pink')
generateButton.grid(pady=5)
passwordField=Entry(root,width=25,bd=2,font=Font)
passwordField.grid(pady=15)
root.mainloop()