Skip to content
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions GUIScripts/QR Code Generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# QR Code Generator

## Aim
The main aim of this script is to get a png format QR Code

## Purpose

To share information in a for of QR code which could work offline.


## Short description of package/script

- Get QR Code of any text using Python's tkinter GUI.
- Download QR Code in png in your local machine
- The script utilizes `pyqrcode`module to convert text to image code
- The `png` module is used in the script to convert the image code in the png format.


## Setup instructions

`
pip install -r requirements.txt
python qr_generator.py
`
- A GUI will open up, enter your text, press submit
- A PNG format QR Code will be downloaded in the current working directory

## Output
![](./Images/vivekScreen01.png)
<br/>
![](./Images/vivekScreen02.png)


## Author(s)

[Vivek](https://github.com/vivekthedev)

30 changes: 30 additions & 0 deletions GUIScripts/QR Code Generator/qr_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import pyqrcode
import png
from tkinter import *
from PIL import ImageTk, Image

# Function to get the data from the input field and export it to png format
def get_code():
data_var = data.get()
qr = pyqrcode.create(str(data_var))
qr.png('code.png', scale=6)


# Basic GUI setup, title and dimensions are set
base = Tk()
base.geometry("400x200")
base.title("QR Code Generator")

# variable to store the input value from the user
data = StringVar()

# Field to get the input from the user
data_entry = Entry(textvariable=data, width="30")
data_entry.place(x=80,y=50)

# button takes get_code() function as 'command' to call it once the button is clicked
button = Button(base,text="Get Code",command=get_code,width="30",height="2",bg="grey")
button.place(x=80,y=100)

# Keep running the gui window
base.mainloop()
2 changes: 2 additions & 0 deletions GUIScripts/QR Code Generator/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pypng==0.0.21
PyQRCode==1.2.1