diff --git a/QRCODE-Generator/QRCODE-Generator.py b/QRCODE-Generator/QRCODE-Generator.py new file mode 100644 index 0000000..3591d3b --- /dev/null +++ b/QRCODE-Generator/QRCODE-Generator.py @@ -0,0 +1,62 @@ +import qrcode +import tkinter as tk +from PIL import Image, ImageTk +import webbrowser + +def generate_qr_code(): + input_URL = url_entry.get() + + qr = qrcode.QRCode( + version=1, + error_correction=qrcode.constants.ERROR_CORRECT_L, + box_size=15, + border=4, + ) + + qr.add_data(input_URL) + qr.make(fit=True) + + img = qr.make_image(fill_color="red", back_color="white") + img.save("url_qrcode.png") + + # Display the QR code image in the GUI + qr_image = Image.open("url_qrcode.png") + qr_image = qr_image.resize((400, 400), Image.LANCZOS) # Larger size + qr_photo = ImageTk.PhotoImage(qr_image) + qr_label.config(image=qr_photo) + qr_label.image = qr_photo + + # Store the URL to open when the QR code is clicked + qr_label.url = input_URL + +def open_url(event): + # Open the URL in the default web browser + webbrowser.open(event.widget.url) + +# Create a GUI window +window = tk.Tk() +window.title("QR Code Generator") + +# Increase the window size +window.geometry("600x600") + +# Create and place a label for the URL input +url_label = tk.Label(window, text="Enter the URL:", font=("Arial", 14)) +url_label.pack(pady=10) # Adds vertical spacing + +url_entry = tk.Entry(window, font=("Arial", 14)) +url_entry.pack(pady=10) # Adds vertical spacing + +# Create and place a button to generate the QR code +generate_button = tk.Button(window, text="Generate QR Code", command=generate_qr_code, font=("Arial", 14)) +generate_button.pack(pady=10) # Adds vertical spacing + +# Create a label to display the generated QR code +qr_label = tk.Label(window) +qr_label.pack(pady=10) # Adds vertical spacing + +# Bind a click event to the QR code label +qr_label.bind("", open_url) + +# Start the GUI main loop +window.mainloop() diff --git a/QRCODE-Generator/README.md b/QRCODE-Generator/README.md new file mode 100644 index 0000000..382f4d5 --- /dev/null +++ b/QRCODE-Generator/README.md @@ -0,0 +1,50 @@ +# QRCODE +QRCODE generator using python + +# QR Code Generator with GUI + +This Python application allows you to generate QR codes for website URLs with a graphical user interface (GUI). Users can input a URL, and the program generates and displays the QR code in the GUI. Additionally, clicking on the generated QR code will open the URL in the default web browser. + +## Prerequisites + +To run this application, you need to have Python installed on your system. The code relies on the following Python libraries: + +- `qrcode`: For generating QR codes. +- `tkinter`: For creating the GUI. +- `Pillow` (PIL Fork): For image processing and displaying the QR code. +- `webbrowser`: For opening URLs in the default web browser. + +You can install the required libraries using `pip`: + +## shell +`pip install qrcode[pil] pillow` + +## Usage +Clone this repository or download the main.py file. +Run the application by executing the main.py script. + +## shell + +Copy code +python main.py +A GUI window will open with the following elements: + +A label and text entry field for entering a URL. +A button to generate the QR code. +A label to display the generated QR code. +Enter a URL in the text entry field and click the "Generate QR Code" button. + +The program will generate the QR code and display it in the GUI. + +Click on the generated QR code, and it will open the URL in your default web browser. + +## OUTPUT + +
+ + + + +
+Contributing +Feel free to contribute to this project by submitting issues, feature requests, or pull requests. \ No newline at end of file diff --git a/QRCODE-Generator/assets/img/imgg1.png b/QRCODE-Generator/assets/img/imgg1.png new file mode 100644 index 0000000..0a79d66 Binary files /dev/null and b/QRCODE-Generator/assets/img/imgg1.png differ diff --git a/QRCODE-Generator/assets/img/imgg2.png b/QRCODE-Generator/assets/img/imgg2.png new file mode 100644 index 0000000..4ba7bef Binary files /dev/null and b/QRCODE-Generator/assets/img/imgg2.png differ