Hint

Hint

🧠 Not sure where to start?

Start by importing the necessary libraries:

import random
import string
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QLineEdit, QPushButton, QVBoxLayout

Now think: how can you create a class that builds the GUI and connects buttons to functions? Maybe define a PasswordGeneratorApp class that inherits from QWidget?

class PasswordGeneratorApp(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("Password Generator")
        self.setup_ui()

Inside setup_ui(), you can use QVBoxLayout() to organize labels, inputs, and buttons vertically. Then, create the logic to generate and save passwords inside separate methods like generate_password() and save_password().