Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Commit 5b68fb0

Browse files
gui password generator added
1 parent 86a236c commit 5b68fb0

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed
66.1 KB
Binary file not shown.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
from tkinter import *
2+
import string
3+
import random
4+
5+
root = Tk()
6+
root.title("Password Generator - By Rohit")
7+
root.geometry("1000x700")
8+
root.wm_iconbitmap("pass.ico")
9+
# Function to generate a password
10+
def generate():
11+
if passLen.get() == 0:
12+
TextArea.insert(1.0, "Please Enter password length.")
13+
else:
14+
TextArea.delete(1.0, END)
15+
if passType.get() == 1:
16+
s1 = string.digits
17+
s = []
18+
s.extend(s1)
19+
random.shuffle(s)
20+
password = "".join(s[0:passLen.get()])
21+
TextArea.insert(1.0, f"Your password is : {password}")
22+
elif passType.get() == 2:
23+
s1 = string.ascii_lowercase
24+
s2 = string.digits
25+
s = []
26+
s.extend(s1)
27+
s.extend(s2)
28+
random.shuffle(s)
29+
password = "".join(s[0:passLen.get()])
30+
TextArea.insert(1.0, f"Your password is : {password}")
31+
elif passType.get() == 3:
32+
s1 = string.ascii_lowercase
33+
s2 = string.ascii_uppercase
34+
s3 = string.digits
35+
s4 = string.punctuation
36+
s = []
37+
s.extend(s1)
38+
s.extend(s2)
39+
s.extend(s3)
40+
s.extend(s4)
41+
random.shuffle(s)
42+
password = "".join(s[0:passLen.get()])
43+
TextArea.insert(1.0, f"Your password is : {password}")
44+
45+
else:
46+
TextArea.insert(1.0, "Invalid Password Type\n")
47+
48+
# Length of password
49+
passLen = IntVar()
50+
passLen.set(0)
51+
passType = IntVar()
52+
53+
Label(root, text="Welcome to Password Generator", font="lucida 20 bold").pack(pady=10)
54+
f1 = Frame(root)
55+
# Label for Enter Password length
56+
l1 = Label(f1, text="Enter password length", font="lucida 10 bold")
57+
l1.grid(row=1, column=3, pady=20)
58+
59+
# Entry widget
60+
e1 = Entry(f1, textvariable=passLen)
61+
e1.grid(row=1, column=5)
62+
63+
# Radiobuttons for password type
64+
r1 = Radiobutton(f1, text="PIN", value=1, variable=passType, padx=10, font="lucida 12").grid(row=2, column=4, )
65+
r2 = Radiobutton(f1, text="AlphaNumeric", value=2, variable=passType, padx=10, font="lucida 12").grid(row=3, column=4)
66+
r3 = Radiobutton(f1, text="Extreme Secure", value=3, variable=passType, padx=10, font="lucida 12").grid(row=4, column=4)
67+
68+
# Submit Button
69+
b1 = Button(f1, text="Submit", command=generate, font="lucida 12")
70+
b1.grid(row=5, column=4, pady=10)
71+
72+
# Textarea to show generated password
73+
TextArea = Text(f1)
74+
TextArea.grid(row=6, column=4)
75+
76+
f1.pack()
77+
78+
79+
root.mainloop()
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# GUI Password Generator
2+
3+
This is a python program created using Tkinter library that is used to create the GUI based applications.
4+
This is a simple Password generator which have three types of password to be generated.
5+
6+
7+
### Prerequisites
8+
The only prerequisites for running this program is Python.
9+
All libraries included in this program are in-built in Python.
10+
-Libraries Used
11+
- Tkinter
12+
- string
13+
- random
14+
15+
16+
### Inside the application
17+
- Enter the length of the password you want.
18+
- Select the type of password type
19+
- PIN
20+
- AlphaNumeric
21+
- Extreme Secure
22+
And now your password will be generated and you can use it anywhere by copying it.
23+
24+
25+
## How to run the Script:
26+
python passwordGenerator.py
27+
28+
## Authon Name:
29+
Rohit Kumar Saini

0 commit comments

Comments
 (0)