Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 026bcf3

Browse files
Merge pull request #1080 from vivekthedev/main
Add New GUI Script (QR Code Generator)
2 parents c7e9753 + d083874 commit 026bcf3

File tree

5 files changed

+69
-0
lines changed

5 files changed

+69
-0
lines changed
10.4 KB
Loading[フレーム]
17.6 KB
Loading[フレーム]

‎GUIScripts/QR Code Generator/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# QR Code Generator
2+
3+
## Aim
4+
The main aim of this script is to get a png format QR Code
5+
6+
## Purpose
7+
8+
To share information in a for of QR code which could work offline.
9+
10+
11+
## Short description of package/script
12+
13+
- Get QR Code of any text using Python's tkinter GUI.
14+
- Download QR Code in png in your local machine
15+
- The script utilizes `pyqrcode`module to convert text to image code
16+
- The `png` module is used in the script to convert the image code in the png format.
17+
18+
19+
## Setup instructions
20+
21+
`
22+
pip install -r requirements.txt
23+
python qr_generator.py
24+
`
25+
- A GUI will open up, enter your text, press submit
26+
- A PNG format QR Code will be downloaded in the current working directory
27+
28+
## Output
29+
![](./Images/vivekScreen01.png)
30+
<br/>
31+
![](./Images/vivekScreen02.png)
32+
33+
34+
## Author(s)
35+
36+
[Vivek](https://github.com/vivekthedev)
37+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import pyqrcode
2+
import png
3+
from tkinter import *
4+
from PIL import ImageTk, Image
5+
6+
# Function to get the data from the input field and export it to png format
7+
def get_code():
8+
data_var = data.get()
9+
qr = pyqrcode.create(str(data_var))
10+
qr.png('code.png', scale=6)
11+
12+
13+
# Basic GUI setup, title and dimensions are set
14+
base = Tk()
15+
base.geometry("400x200")
16+
base.title("QR Code Generator")
17+
18+
# variable to store the input value from the user
19+
data = StringVar()
20+
21+
# Field to get the input from the user
22+
data_entry = Entry(textvariable=data, width="30")
23+
data_entry.place(x=80,y=50)
24+
25+
# button takes get_code() function as 'command' to call it once the button is clicked
26+
button = Button(base,text="Get Code",command=get_code,width="30",height="2",bg="grey")
27+
button.place(x=80,y=100)
28+
29+
# Keep running the gui window
30+
base.mainloop()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pypng==0.0.21
2+
PyQRCode==1.2.1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /