-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |