-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword.py
More file actions
64 lines (46 loc) · 1.97 KB
/
Copy pathpassword.py
File metadata and controls
64 lines (46 loc) · 1.97 KB
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
60
61
62
63
64
from tkinter import *
import string
import random
import pyperclip
def generator():
small_alphabets=string.ascii_lowercase
capital_alphabets=string.ascii_uppercase
numbers=string.digits
special_charecters=string.punctuation
all=small_alphabets+capital_alphabets+numbers+special_charecters
password_length=int(length_Box.get())
if choice.get()==1:
passwordField.insert(0,random.sample(small_alphabets,password_length))
if choice.get()==2:
passwordField.insert(0,random.sample(small_alphabets+capital_alphabets,password_length))
if choice.get()==3:
passwordField.insert(0,random.sample(all,password_length))
def copy():
random_password=passwordField.get()
pyperclip.copy(random_password)
root=Tk()
root.geometry("500x400")
root.config(bg='snow')
choice=IntVar()
Font=('arial',13,'bold')
frame=Frame(root,bg='snow')
frame.pack()
passwordLabel=Label(frame,text='Password Generator Project',font=('times new roman',20,'bold'),fg="red",bg='snow')
passwordLabel.grid(pady=10)
weakradioButton=Radiobutton(frame,text='Strong',value=1,variable=choice,font=Font,bg="coral",)
weakradioButton.grid(pady=5)
mediumradioButton=Radiobutton(frame,text='Medium',value=2,variable=choice,font=Font,bg="gold")
mediumradioButton.grid(pady=5)
strongradioButton=Radiobutton(frame,text='Weak',value=3,variable=choice,font=Font,bg="medium aquamarine")
strongradioButton.grid(pady=5)
lengthLabel=Label(frame,text='Password Length',font=Font,fg='red')
lengthLabel.grid(pady=5)
length_Box=Spinbox(frame,from_=5,to_=18,width=5,font=Font,bg="powder blue")
length_Box.grid(pady=5)
generateButton=Button(frame,text='Generate',font=Font,command=generator,bg="light goldenrod")
generateButton.grid(pady=5)
passwordField=Entry(frame,width=25,bd=2,font=Font,bg="skyblue")
passwordField.grid()
copyButton=Button(frame,text='Copy',font=Font,command=copy,bg="SkyBlue3")
copyButton.grid(pady=5)
root.mainloop()