0% found this document useful (0 votes)
13 views2 pages

QR Code Generator

This document contains a Python script that creates a QR code generator using the Tkinter library for the GUI and the qrcode library for QR code generation. It allows users to input data, generate a QR code, and display it in the application window. The generated QR code is saved as 'qr_code.png' and shown in the interface after creation.

Uploaded by

nikhilmahato526
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

QR Code Generator

This document contains a Python script that creates a QR code generator using the Tkinter library for the GUI and the qrcode library for QR code generation. It allows users to input data, generate a QR code, and display it in the application window. The generated QR code is saved as 'qr_code.png' and shown in the interface after creation.

Uploaded by

nikhilmahato526
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

import qrcode

from tkinter import *


from PIL import Image, ImageTk

# Function to generate QR code


def generate_qr():
qr_data = [Link]()
qr = [Link](
version=1,
error_correction=[Link].ERROR_CORRECT_H,
box_size=10,
border=4,
)
qr.add_data(qr_data)
[Link](fit=True)
img = qr.make_image(fill='black', back_color='white')
[Link]('qr_code.png')

# Display QR code in the window


image = [Link]('qr_code.png')
photo = [Link](image)
image_label.config(image=photo)
image_label.image = photo # keep a reference!

# Main window
root = Tk()
[Link]("QR Code Generator")

# Entry widget to take input data


entry = Entry(root)
[Link]()

# Button to generate QR code


button = Button(root, text="Generate QR Code", command=generate_qr)
[Link]()

# Label to display the QR code


image_label = Label(root)
image_label.pack()

[Link]()

You might also like