ChatDev/WareHouse/QRCodeGenerator_THUNLP_20231015214731/qrcode_generator.py
2023-10-15 21:34:54 -05:00

13 lines
438 B
Python

'''
This file contains the QRCodeGenerator class responsible for generating QR codes.
'''
import qrcode
class QRCodeGenerator:
def __init__(self, data):
self.data = data
def generate_qr_code(self, file_path):
qr = qrcode.QRCode(version=1, box_size=10, border=5)
qr.add_data(self.data)
qr.make(fit=True)
qr_img = qr.make_image(fill="black", back_color="white")
qr_img.save(file_path)