An open API service indexing awesome lists of open source software.

https://github.com/rhythmusbyte/qrcode-generator

A simple url to QR Code Generator.
https://github.com/rhythmusbyte/qrcode-generator

Last synced: about 1 year ago
JSON representation

A simple url to QR Code Generator.

Awesome Lists containing this project

README

          

# QR Code Generator

**QRCode Generator by RhythmusByte**

This Python script allows you to generate a QR code from a URL with customizable colors and save it as an image file.

## Features

- **Custom URL Input:** Encode any URL into a QR code.
- **Customizable Colors:** Choose both the fill color and background color for your QR code.
- **Output File:** Save the QR code image with a custom file name.

## Requirements

- Python 3.x
- `qrcode` library

## Installation

### 1. Clone the Repository

```bash
git clone https://github.com/RhythmusByte/QRCode-Generator.git
cd QRCode-Generator
```

### 2. Set Up the Environment

To avoid issues with system-wide installations, it's recommended to use a virtual environment.

#### a. Create a Virtual Environment

```bash
python3 -m venv myenv
source myenv/bin/activate
```

#### b. Install Dependencies

```bash
pip install qrcode[pil]
```

## Usage

Run the script using Python:

```bash
python qrcodegen.py
```

You will be prompted to:

- Enter the URL to encode in the QR code.
- Specify the name of the output file (e.g., `myqrcode.png`).
- Choose the fill color of the QR code (e.g., `blue`).
- Choose the background color of the QR code (e.g., `aliceblue`).

The script will generate the QR code and save it as the specified image file.

### Example Interaction

```
QRCode Generator by RhythmusByte

Enter the URL to encode in the QR code: https://example.com
Enter the name of the output file (e.g., 'qr_code.png'): example_qr.png
Enter the fill color for the QR code (e.g., 'blue'): red
Enter the background color for the QR code (e.g., 'aliceblue'): white
QR code generated and saved as example_qr.png
Data in QR code: ['https://example.com']
```

## Common Issues

### ModuleNotFoundError: No module named 'qrcode'

If you encounter this error:

```
ModuleNotFoundError: No module named 'qrcode'
```

It means that the `qrcode` module is not installed or not recognized in your environment. To fix this:

1. **Activate the virtual environment** (if you created one):

```bash
source myenv/bin/activate
```

2. **Install the `qrcode` module**:

```bash
pip install qrcode[pil]
```

3. **Run the script again**:

```bash
python qrcodegen.py
```

If you still encounter issues, ensure you're in the correct environment or consider reinstalling the module.