-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword_generator.py
More file actions
60 lines (50 loc) · 1.09 KB
/
Copy pathpassword_generator.py
File metadata and controls
60 lines (50 loc) · 1.09 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import tkinter as tk
import random
import string
def generate_password():
length = int(length_entry.get())
characters = string.ascii_letters + string.digits + string.punctuation
password = ""
for i in range(length):
password += random.choice(characters)
result_label.config(text="Generated Password:\n" + password)
window = tk.Tk()
window.title("Password Generator")
window.geometry("350x250")
window.configure(bg="#E6E6FA") # lavender background
tk.Label(
window,
text="Password Generator",
font=("Arial", 16),
bg="#E6E6FA",
fg="#2F4F4F"
).pack(pady=10)
tk.Label(
window,
text="Enter Password Length:",
bg="#E6E6FA",
fg="#000080"
).pack()
length_entry = tk.Entry(
window,
bg="white",
fg="black"
)
length_entry.pack(pady=5)
tk.Button(
window,
text="Generate Password",
command=generate_password,
bg="#87CEFA",
fg="black"
).pack(pady=15)
result_label = tk.Label(
window,
text="",
font=("Arial", 12),
bg="#E6E6FA",
fg="#4B0082",
wraplength=300
)
result_label.pack(pady=10)
window.mainloop()