A simple and user-friendly desktop application that generates QR codes from URLs using Python's Tkinter GUI framework.
This project is available on hackr.io
QR Code Generator
This application provides an intuitive graphical interface for creating QR codes from any URL. Users can input a URL, generate a QR code, and view it directly within the application. The generated QR code is also saved as a PNG file for external use.
- Simple GUI: Clean and modern interface built with Tkinter
- URL Input: Easy-to-use text entry field for URLs
- QR Code Generation: High-quality QR codes with error correction
- Live Preview: Generated QR codes are displayed immediately in the app
- File Export: Automatically saves QR codes as
qrcode.png
- Error Handling: Validates input and provides user feedback
- Responsive Design: Well-organized layout with proper spacing and styling
- Python 3.11 or higher
- Required packages (automatically installed):
qrcode
- QR code generation librarypillow
- Image processing and display
- Clone or download this project to your local machine
- Install dependencies - The required packages are automatically managed through the
pyproject.toml
file - Run the application:
python main.py
These are the required libraries for this project
I've used the following Python libraries:
qrcode for generating QR codes.
tkinter for creating the GUI.
Pillow (PIL) for displaying the generated QR code.
You can easily install them with this command:
pip install qrcode pillow
- Launch the application by running
python main.py
- Enter a URL in the text input field (e.g.,
https://www.example.com
) - Click "Generate QR Code" button
- View the result:
- The QR code will appear in the application window
- A success message will confirm generation
- The QR code is automatically saved as
qrcode.png
in the project directory
- Version: 1 (21x21 modules)
- Error Correction: High level (ERROR_CORRECT_H)
- Box Size: 5 pixels per module
- Border: 2 modules wide
- Colors: Black foreground on white background
- Main Window: 400x500 pixels with light blue background
- URL Entry: Helvetica font, 40 characters wide
- Generate Button: Styled with blue theme and hover effects
- QR Display: Centered image display area
- Status Label: Shows generation success/error messages
project/
├── main.py # Main application file
├── qrcode.png # Generated QR code (created after first use)
├── pyproject.toml # Project dependencies
└── README.md # This documentation
The application includes built-in error handling:
- Empty URL validation: Prevents generation with blank input
- Error dialog boxes: Clear error messages for user guidance
- Image processing errors: Graceful handling of PIL/image operations
You can easily modify the application by adjusting these parameters in main.py
:
- Window size: Change
root.geometry("400x500")
- QR code size: Modify
box_size
parameter - Colors: Update
fill_color
andback_color
- Error correction: Change
error_correction
level - Styling: Modify the
ttk.Style()
configurations
- qrcode: Core library for generating QR codes with various customization options
- Pillow (PIL): Required for image processing, display, and saving QR codes as PNG files
- tkinter: Built-in Python GUI framework (no additional installation needed)
This project is open source and available for educational and personal use.
Common Issues:
- Import errors: Ensure all dependencies are installed via
uv
orpip
- Display issues: Verify that your system supports Tkinter GUI applications
- File permissions: Check write permissions in the project directory for saving QR codes
Running the Application:
- Use the "Run" button in your IDE, or
- Execute
python main.py
in the terminal