🔐 Python Password Generator with GUI
Level: Beginner
Tech used: Python, Tkinter, random, string
📦 What You’ll Build
A Python desktop app that creates random, secure passwords. Users can click a button to generate a password instantly using letters, numbers, and symbols.
🧰 Tools Needed
- Python 3.x installed
- tkinter (comes with Python)
💻 Sample Python Code
import tkinter as tk
import random
import string
def generate_password():
length = 12
characters = string.ascii_letters + string.digits + string.punctuation
password = ''.join(random.choice(characters) for _ in range(length))
result.set(password)
root = tk.Tk()
root.title("Password Generator")
tk.Label(root, text="Click to generate a strong password:").pack(pady=10)
result = tk.StringVar()
tk.Entry(root, textvariable=result, width=30).pack(pady=5)
tk.Button(root, text="Generate", command=generate_password).pack(pady=10)
root.mainloop()
📘 Concepts Covered
- Random selection of characters
- Using
string
andrandom
modules - Building a responsive GUI with Tkinter
🔗 Helpful Resources
Recommended Gear:
🛍️ Best USB Security Keys on Amazon
Comments
Post a Comment