forked from ndleah/python-mini-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqrGenerator.py
More file actions
28 lines (21 loc) · 685 Bytes
/
qrGenerator.py
File metadata and controls
28 lines (21 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pyqrcode
import png
from tkinter import *
# This Function is responsible to take the input -> Convert it to Image Code -> Convert Image code to png.
def get_code():
data_var = data.get()
qr = pyqrcode.create(str(data_var))
qr.png('code.png', scale=6)
#Get a Tk window of 400 * 200
base = Tk()
base.geometry("400x200")
base.title("QR Code Generator")
# variable to store text for QR Code
data = StringVar()
# Field to input text
dataEntry = Entry(textvariable=data, width="30")
dataEntry.place(x=80,y=50)
# Call get_code() on click
button = Button(base,text="Get Code",command=get_code,width="30",height="2",bg="grey")
button.place(x=80,y=100)
base.mainloop()