
خب برای این پروژه وسایلی که نیاز دارید :
خود برنامه پایتون
کتابخانه
tkinter
کتابخانه secrets
کتابخانه string

کتابخانه های لازم را نصب کنید و کد زیر را دخل آن وارد کنید .
import tkinter as tk from tkinter import messagebox import secrets import string def generate_strong_password(input_number: int, length: int) -> str: """ Generates a strong, random password based on an input number and desired length. """ alphabet = string.ascii_letters + string.digits + string.punctuation # Ensure length is at least a minimum reasonable value if input causes it to be too small password_length = max(length, 8) # Minimum length of 8 # Use secrets module for cryptographically secure random generation password = ''.join(secrets.choice(alphabet) for i in range(password_length)) return password def generate_and_copy_password(): """ Generates a password based on user input and copies it to the clipboard. """ try: # Get the desired length from the input field length_str = length_entry.get() if not length_str: messagebox.showwarning("ورودی نامعتبر", "لطفاً طول رمز عبور را وارد کنید.") return password_length = int(length_str) # We can use a dummy number for generation if we only care about length, # or incorporate it if we want the number to influence the *selection* of characters/patterns, # but for simplicity with secrets.choice, length is the main factor here. # Let's generate a password based on the length provided. # If you want the number input to influence generation beyond length, we can modify this. # For now, let's assume the user wants to specify length directly. # If you still want to use the input number, you could do something like this: # input_num_for_generation = int(input_number_entry.get()) if input_number_entry.get() else 12345 # generated_password = generate_strong_password(input_num_for_generation, password_length) # Simpler approach: just use the specified length generated_password = generate_strong_password(12345, password_length) # Dummy input_number # Update the password display label password_display.config(text=generated_password) # Copy the password to the clipboard root.clipboard_clear() root.clipboard_append(generated_password) root.update() # Required to update the clipboard messagebox.showinfo("موفقیت!", f"رمز عبور تولید و کپی شد:\n{generated_password}") except ValueError: messagebox.showerror("خطا", "لطفاً طول رمز عبور را به صورت یک عدد صحیح وارد کنید.") except Exception as e: messagebox.showerror("خطای پیشبینی نشده", f"متاسفانه خطایی رخ داد: {e}") # --- GUI Setup --- root = tk.Tk() root.title("تولید کننده رمز عبور قوی") root.geometry("500x300") # Set a default window size # Input field for password length tk.Label(root, text="طول رمز عبور مورد نظر:").pack(pady=5) length_entry = tk.Entry(root) length_entry.insert(0, "16") # Default length length_entry.pack(pady=5) # Button to generate password and copy generate_button = tk.Button(root, text="تولید و کپی رمز عبور", command=generate_and_copy_password) generate_button.pack(pady=15) # Label to display the generated password tk.Label(root, text="رمز عبور تولید شده:").pack(pady=5) password_display = tk.Label(root, text="--", fg="blue", font=("Arial", 12, "bold")) password_display.pack(pady=10) # Start the Tkinter event loop root.mainloop()
خب کد را اجرا کنید ، صفحه پایین را می بینید .

حالا اگر تولید و کپی رمز عبور را بزنیم برایتان کپی میکند .
راستی اگر 10000 به بعد وارد کنید کامپیوتر هنگ میکند .
برای دانلود همین پایتون یا فایل تبدیل شده به برنامه روی نوشته لینک بزنید و 15ثانیه صبر کنید و فایل را دریافت کنید .
اگر ایده یا پروژه ای دیگری میخواهید در نظر ها بنویسید .