forked from 790hanu/Annex-qr-code-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQrcodesim1.py
59 lines (50 loc) · 1.05 KB
/
Qrcodesim1.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from tkinter import *
from tkinter import messagebox
import pyqrcode
ws = Tk()
ws.title("QR CODE GENERATOR")
ws.config(bg = '#D2F2F2')
def generate_QR():
if len(user_input.get()) != 0:
global qr, img
qr = pyqrcode.create(user_input.get())
img = BitmapImage(data = qr.xbm(scale = 10))
else:
messagebox.showwarning('warning', 'All Fields are Required!')
try:
display_code()
except:
pass
def display_code():
img_lbl.config(image = img)
output.config(text = "SUCCESSFULLY GENERATED the QR code of: " + user_input.get())
lbl = Label(
ws,
text = "Enter Any String To generate Unique QR: ",
bg = '#D2F2F2'
)
lbl.pack()
user_input = StringVar()
entry = Entry(
ws,
textvariable = user_input
)
entry.pack(padx=20)
button = Button(
ws,
text = "CLICK TO GENERATE",
width = 25,
command = generate_QR
)
button.pack(pady = 30)
img_lbl = Label(
ws,
bg = '#D2F2F2')
img_lbl.pack()
output = Label(
ws,
text = "",
bg = '#D2F2F2'
)
output.pack()
ws.mainloop()