Skip to content

Commit 82a6481

Browse files
authored
Merge pull request #19 from lironmiz/QRCodeGenerater
Add files
2 parents 8c73ee4 + aa06923 commit 82a6481

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

QR_code_Generater.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import pyqrcode
2+
from tkinter import messagebox
3+
from tkinter import Tk, Label, StringVar, Entry, Button, BitmapImage
4+
5+
FONT = ("Courier", 30)
6+
7+
# Tk object
8+
tk = Tk()
9+
# Define the settings of the window
10+
tk.title("liron QR_generator")
11+
tk.config(bg="#E8DFCA")
12+
13+
def generate_qr()->None:
14+
"""
15+
the function generator QR code
16+
param: none
17+
return: none
18+
"""
19+
global qr, image
20+
# Checking user input
21+
if len(user_input.get()) != 0:
22+
qr = pyqrcode.create(user_input.get())
23+
image = BitmapImage(data=qr.xbm(scale=10))
24+
else:
25+
messagebox.showwarning("warning", "fields are required!!")
26+
try:
27+
display_code()
28+
except:
29+
pass
30+
31+
def display_code()->None:
32+
"""
33+
the function display the qr code
34+
param: none
35+
return: none
36+
"""
37+
image_label.config(image=image)
38+
output.config(text=f"Qr code : {user_input.get()}")
39+
40+
label = Label(tk, text="enter Text or Url", bg="#F25252", padx=30, pady=20, font=FONT)
41+
label.pack(pady=15)
42+
43+
user_input = StringVar()
44+
entry = Entry(tk, textvariable=user_input, width=50, font=FONT)
45+
entry.pack(padx=40, pady=30)
46+
47+
button = Button(tk, text="generate qr", width=20, command=generate_qr, font=FONT)
48+
button.pack(padx=15, pady=15)
49+
50+
image_label = Label(tk, bg="#e6e6e6")
51+
image_label.pack()
52+
53+
output = Label(tk, text="", bg="#F25252")
54+
output.pack(pady=15)
55+
56+
tk.mainloop()

0 commit comments

Comments
 (0)