forked from hackison1/Hacktoberfest-2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
passwordgenerator.py
42 lines (41 loc) · 1.89 KB
/
passwordgenerator.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
#My Password Generator
from tkinter import *
import pyperclip
import random
root = Tk()
root.geometry("750x350")
root.title("My Calc")
root["bg"]= "black"
passstr = StringVar()
passlen = IntVar()
def generate():
pass1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8',
'9', '0', ' ', '!', '@', '#', '$', '%', '^', '&',
'*', '(', ')']
pass2 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8',
'9', '0', ' ', '!', '@', '#', '$', '%', '^', '&',
'*', '(', ')']
password = ""
for x in range(passlen.get()):
password = password + random.choice(pass1)
passstr.set(password)
def copytoclipboard():
random_password = passstr.get()
pyperclip.copy(random_password)
Label(root, text="Kartik's Password Generator ",bg="black",fg="white",font="Algerian 20 bold").pack()
Label(root, text="Enter password length",fg="white",bg="black",font="Algerian 12 bold").pack(pady=10)
Entry(root, textvariable=passlen,font=5).pack(pady=8)
Button(root, text="Generate Password",bg="black",fg="white",pady=15,font="Algerian 12", command=generate).pack(pady=7)
Entry(root, textvariable=passstr,font=5).pack(pady=8)
Button(root, text="Copy to Clipboard", bg="black",fg="white",pady=15,font="Algerian 12",command=copytoclipboard).pack()
root.mainloop()