-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassword_Strength.py
More file actions
32 lines (23 loc) · 1.08 KB
/
Copy pathPassword_Strength.py
File metadata and controls
32 lines (23 loc) · 1.08 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
#Write a Python program to create an application that accepts a password from the user and displays its strength based on the length of the password using the Python Tkinter library.
import tkinter as tk
def check_password_strength():
password = password_entry.get()
password_length = len(password)
if password_length < 6:
strength_label.config(text="Password strength: Weak", fg="red")
elif 6 <= password_length < 10:
strength_label.config(text="Password strength: Medium", fg="orange")
else:
strength_label.config(text="Password strength: Strong", fg="green")
root = tk.Tk()
root.title("Password Strength Checker")
root.geometry("300x200")
password_label = tk.Label(root, text="Enter Password:")
password_label.pack(pady=10)
password_entry = tk.Entry(root, show="*", width=20)
password_entry.pack(pady=5)
check_button = tk.Button(root, text="Check Strength", command=check_password_strength)
check_button.pack(pady=10)
strength_label = tk.Label(root, text="Password strength: Not checked", fg="black")
strength_label.pack(pady=5)
root.mainloop()