Python Generate QR code script with a demo.

Python Generate QR code script with a demo.

Python Generate QR code script with a demo.
 
Python | generate QR code script with a demo and code step by step using Python.
 
Step 1 : Install pyqrcode
pip install pyqrcode

Step 2 : Import modules.

import pyqrcode
from pyqrcode import QRCode

Step 3 : Understand the complete generate QR code python script as below:

import pyqrcode 
from pyqrcode import QRCode

# set QR code image name
qrcode_image_name = "QR-code-img.png"

# Set string or any Transaction Id which represent the QR code
stringPattern = "123456798-any-string-inside-QR-code"

# Generate / Create QR code
urlObj = pyqrcode.create(str(stringPattern)) 

# Save QR code on your destination path and set the params here.
urlObj.png(qrcode_image_name, scale=8, module_color=[0, 0, 0, 128], background=[0xff, 0xff, 0xff])

Any query? Please share your thoughts in the comments below. Glad to help you!
Thanks!

Was this page helpful? Do not forget to share this post!

Leave a Reply

Your email address will not be published. Required fields are marked *