-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
93 lines (75 loc) · 1.47 KB
/
app.py
File metadata and controls
93 lines (75 loc) · 1.47 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from tkinter import *
from tkinter import messagebox
import pyqrcode
import png
from pyqrcode import QRCode
ws = Tk()
ws.geometry("500x600")
ws.resizable(False, False)
ws.title("QR CODE GENERATOR")
ws.config(bg='#eb7965')
def generate():
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('All Fields are Required!')
try:
display_code()
except:
pass
def display_code():
img_l.config(image=img)
output.config(text="SUCCESSFULLY GENERATED the QR code")
def save():
qr.png(f'{user_input1.get()}.png', scale=25)
l = Label(
ws,
text="Enter Text/URL: ",
bg='#eb7965'
)
l.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
)
button.pack(pady=30)
l1 = Label(
ws,
text="Enter file name: ",
bg='#eb7965'
)
l1.pack()
user_input1 = StringVar()
entry1 = Entry(
ws,
textvariable=user_input1
)
entry1.pack(padx=20)
button1 = Button(
ws,
text="CLICK TO SAVE",
width=25,
command=save
)
button1.pack(pady=30)
img_l = Label(
ws,
bg='#eb7965')
img_l.pack()
output = Label(
ws,
text="",
bg='#eb7965'
)
output.pack()
ws.mainloop()