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 ebb1284

Browse files
Update qr_generator.py
Add : comments to describe the code
1 parent acdb942 commit ebb1284

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎GUIScripts/QR Code Generator/qr_generator.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,28 @@
33
from tkinter import *
44
from PIL import ImageTk, Image
55

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

12+
13+
# Basic GUI setup, title and dimensions are set
1114
base = Tk()
1215
base.geometry("400x200")
1316
base.title("QR Code Generator")
1417

18+
# variable to store the input value from the user
1519
data = StringVar()
1620

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

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

29+
# Keep running the gui window
2330
base.mainloop()

0 commit comments

Comments
(0)

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