-
Notifications
You must be signed in to change notification settings - Fork 0
/
pass-gen-gui.py
43 lines (34 loc) · 1.35 KB
/
pass-gen-gui.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
#importing Libraries
from tkinter import *
import random, string
import pyperclip
#initialize window
root =Tk()
root.geometry("400x400")
root.resizable(0,0)
root.title("Hulk - PASSWORD GENERATOR")
#heading
heading = Label(root, text = 'PASSWORD GENERATOR' , font ='arial 15 bold').pack()
Label(root, text ='STAY SAFE! STAY PROTECTED !', font ='arial 15 bold').pack(side = BOTTOM)
#select password length
pass_label = Label(root, text = 'PASSWORD LENGTH', font = 'arial 10 bold').pack()
pass_len = IntVar()
length = Spinbox(root, from_ = 8, to_ = 32 , textvariable = pass_len , width = 15).pack()
#define function
pass_str = StringVar()
def Generator():
password = ''
for x in range (0,4):
password = random.choice(string.ascii_uppercase)+random.choice(string.ascii_lowercase)+random.choice(string.digits)+random.choice(string.punctuation)
for y in range(pass_len.get()- 4):
password = password+random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits + string.punctuation)
pass_str.set(password)
#button
Button(root, text = "GENERATE PASSWORD" , command = Generator ).pack(pady= 5)
Entry(root , textvariable = pass_str).pack()
#function to copy
def Copy_password():
pyperclip.copy(pass_str.get())
Button(root, text = 'COPY TO CLIPBOARD', command = Copy_password).pack(pady=5)
# loop to run program
root.mainloop()