The main aim of this project is to create a QR code for any website submitted via the app. The app provides a user-friendly interface for generating customizable QR codes with different patterns, colors, and sizes. It also validates the submitted URL and allows users to save the generated QR code with a timestamped filename.
The project consists of two main Python files:
app.py
(Frontend using PyQt5)qrcode_gen.py
(QR Code generation and URL validation logic)
This file contains the frontend code for the app built with PyQt5. The app provides:
- An input field to enter the URL for which a QR code is to be generated.
- Two buttons:
- Generate QR Code: Generates a QR code with random patterns, colors, and backgrounds.
- Save QR Code: Saves the generated QR code with a default timestamped filename.
- A display area that shows the QR code once it is generated. Each time the "Generate QR Code" button is clicked, a new QR code with a different design is displayed.
Additional features:
- If the URL entered is invalid, an error message is displayed, asking the user to input a valid URL.
- Once the QR code is saved, a popup message confirms that the QR code has been successfully saved.
This file contains the core logic for QR code generation and URL validation:
generate_qr_code
function: This function is called byapp.py
to generate the QR code when the user clicks the "Generate QR Code" button.- URL validation is also handled in this file, ensuring the URL format is correct before generating the QR code.
- QR codes are generated with random patterns, colors, and fixed sizes, offering a variety of styles.
- QR codes are saved with a default timestamp as filename in a specified folder.
Sample output showing various QR codes generated by the app with different patterns and background colors.
- Clone or download the repository to your local machine.
- Install all required libraries from the
requirements.txt
file:pip install -r requirements.txt
- Run the app by executing
app.py
:python app.py
Ensure the following Python libraries are installed (available in requirements.txt
):
- PyQt5
- qrcode
- Pillow (for image manipulation)