A desktop QR code generator built with Python 3.14, PySide6, qrcode, and Pillow.
This app provides a simple GUI for generating QR codes in vCard format from user-provided text, URLs, contact details, payment strings, or other QR-compatible content.
- Generate QR codes from custom text input
- Save generated QR codes as image files
- Desktop GUI built with PySide6 / Qt
- Configurable default output path and QR styling through
.env - Clean Python project structure using
pyproject.toml - Development tools included for testing, linting, and formatting
- Python 3.14
- PySide6
- qrcode
- Pillow
- python-dotenv
- pytest
- pytest-qt
- ruff
QRCodeGeneratorApp/
├── .env
├── .env.example
├── .gitignore
├── pyproject.toml
├── README.md
├── src/
│ └── qrgenerator/
│ ├── __init__.py
│ ├── main.py
│ ├── main_window.py
│ ├── config.py
│ └── qr_service.py
└── tests/
└── test_qr_service.py
- Python 3.14
- pip
- Windows, macOS, or Linux
This project is currently developed using a local Python virtual environment.
cd "C:\path\to\QRCodeGeneratorApp"For macOS or Linux:
cd "/path/to/QRCodeGeneratorApp"On Windows:
py -3.14 -m venv .venv
.\.venv\Scripts\Activate.ps1On macOS or Linux:
python3.14 -m venv .venv
source .venv/bin/activateAfter activation, the terminal should show (.venv).
python -m pip install --upgrade pipInstall the app in editable development mode:
pip install -e ".[dev]"This installs the main app dependencies and development tools.
Main dependencies:
PySide6
qrcode[pil]
Pillow
python-dotenv
Development dependencies:
pytest
pytest-qt
ruff
Create a .env file in the project root.
Example:
APP_NAME=QR Generator
DEFAULT_OUTPUT_DIR=output
DEFAULT_QR_FILENAME=qr_code.png
QR_BOX_SIZE=10
QR_BORDER=4
QR_FILL_COLOR=black
QR_BACK_COLOR=white
LOG_LEVEL=INFOA .env.example file should also be included in the repository so other users know which settings are required.
The .env file is used for local configuration and should not be committed to Git.
After installing the project, run:
qrgeneratorAlternatively, run the module directly:
python -m qrgenerator.main- Open the app.
- Enter the content you want to encode into a QR code.
- Click the generate button.
- The generated QR code will be saved to the configured output directory.
By default, the output file is saved as:
output/qr_code.png
To verify that all required packages are installed correctly:
python -c "import qrcode; from PIL import Image; from PySide6 import QtWidgets; print('All imports OK')"Expected output:
All imports OK
Run all tests:
pytestExample test coverage should include:
- QR code generation
- Output file creation
- Empty input validation
- Configuration loading
Format the code:
ruff format .Check for linting issues:
ruff check .Fix automatically fixable linting issues:
ruff check . --fixFor Windows, the app can be packaged into an executable using PyInstaller.
Install PyInstaller:
pip install pyinstallerBuild the app:
pyinstaller --name QRGenerator --windowed src\qrgenerator\main.pyThe output will be created in:
dist/QRGenerator/
For macOS, the app can be packaged later as a .app bundle.
Make sure your virtual environment is activated, then reinstall dependencies:
pip install -e ".[dev]"Do not install pil.
Use Pillow instead:
pip install PillowOr reinstall all project dependencies:
pip install -e ".[dev]"If Windows PowerShell prevents activation, run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserThen activate again:
.\.venv\Scripts\Activate.ps1If pip install -e ".[dev]" fails with an error saying it cannot determine which files to ship, make sure the project contains:
src/qrgenerator/__init__.py
Also ensure pyproject.toml includes:
[tool.hatch.build.targets.wheel]
packages = ["src/qrgenerator"]This project is for internal or personal use unless a license is added.