diff --git a/qr_code_generator b/qr_code_generator new file mode 100644 index 0000000..b4e7ebf --- /dev/null +++ b/qr_code_generator @@ -0,0 +1,37 @@ +import qrcode + +def generate_google_drive_qr(): + try: + #Paste your public Google Drive shareable link here + drive_link = input("Paste your Google Drive link here: ").strip() + + if not drive_link: + print("Error: Link cannot be empty!") + return + + #Initialize QR Code object (to control version and box size) + qr = qrcode.QRCode( + version=1, + error_correction=qrcode.constants.ERROR_CORRECT_M, + box_size=10, + border=4, + ) + + #Add the Drive link to the QR data + qr.add_data(drive_link) + qr.make(fit=True) + + #Generate the image + img = qr.make_image(fill_color="black", back_color="white") + + #Set the file path and save (in the Current Working Directory) + file_path = "drive_qr_code.png" + img.save(file_path) + + print(f"\nSuccess! QR Code has been saved to: {file_path}") + + except Exception as e: + print(f"Technical error occurred: {e}") + +if __name__ == "__main__": + generate_google_drive_qr()