Skip to content

Commit

Permalink
QRCodeConverter (Py-Contributors#193)
Browse files Browse the repository at this point in the history
* Added code and files for QRCodeConverter.

* Edited Script.py to pass flake8 standards.

* Changed folder name to lowercase.
  • Loading branch information
dhiganthrao authored Oct 5, 2020
1 parent 49aafcc commit bfe5d5e
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
Binary file added qr-code-scanner/QRCode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added qr-code-scanner/QRCode-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions qr-code-scanner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# URL to QR Code Scanner

This is a simple Python script aimed at converting long or short website URLs into QR codes to be scanned.

## Requirements

It is enough to run `pip install -r requirements.txt` to install all the requirements necessary for this script.

## Usage

Simply run `python Script.py` in your terminal and enter the URL to be converted into a QR code.

## Screenshots and sample QR codes

![Screenshot](Screenshot.png)

QR code for [GitHub](https://www.github.com):
![QR Code](QRCode-2.png)
Binary file added qr-code-scanner/Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions qr-code-scanner/Script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pyqrcode
# import png
# from pyqrcode import QRCode


def QRCodeConverter(url, count):
qr = pyqrcode.create(url) # Generating the QR code
# Saving the QR code as a PNG
qr.png(f'./QRCodeConverter/QRCode-{count}.png', scale=6)
print("QR Code saved!")


choice = 'y'
count = 0
while(choice == 'y' or choice == 'yes'):
count = count + 1
url = input("Enter the URL to convert into a QR Code: ")
QRCodeConverter(url, count)
print('Do you want to convert another URL?')
choice = input('(y/yes for yes, any other key for no): ')
2 changes: 2 additions & 0 deletions qr-code-scanner/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PyQRCode==1.2.1
pypng==0.0.20

0 comments on commit bfe5d5e

Please sign in to comment.