From c76a239eb0cf6569a0da634ce394c40c8cbd3f36 Mon Sep 17 00:00:00 2001 From: Akshay R <157674473+Akshay-Ramesh-VITC@users.noreply.github.com> Date: Sun, 19 Jan 2025 14:31:23 +0530 Subject: [PATCH] Update qr.py Have Updated the QR code for Task #176, it will generate a QR code image for the input link. --- qr.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/qr.py b/qr.py index b097afbd..52428ad2 100644 --- a/qr.py +++ b/qr.py @@ -1,11 +1,15 @@ -import pyqrcode -from pyqrcode import QRCode - -# String which represent the QR code -s = "https://fueler.io/arjun_ms" - -# Generate QR code -url = pyqrcode.create(s) - -# Create and save the png file naming "myqr.png" -url.svg("myyoutube.svg", scale = 8) \ No newline at end of file +import qrcode +def generate_qrcode(txt): + qr=qrcode.QRCode( # type: ignore + version=1, + error_correction=qrcode.ERROR_CORRECT_L, + box_size=10, + border=4 + ) + qr.add_data(txt) + qr.make(fit=True) + img=qr.make_image(fill_color='black',back_color='white') + img.save('qrimg.png') + +url=input('Enter the url: ') +generate_qrcode(url)