Skip to content

Commit

Permalink
password generator gui
Browse files Browse the repository at this point in the history
  • Loading branch information
R3DHULK authored Nov 21, 2022
1 parent f375d8a commit 4dcbead
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions pass-gen-gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,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()

0 comments on commit 4dcbead

Please sign in to comment.