-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQRCode.py
33 lines (27 loc) · 798 Bytes
/
QRCode.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
import io
import pyqrcode
from base64 import b64encode
import eel
#eel inti (detecting web folder)
eel.init('web')
@eel.expose
def dummy(dummy_param):
print("I got a parameter: ", dummy_param)
return "string_value", 1, 1.2, True, [1, 2, 3, 4], {"name": "eel"}
#Generating Data when button get clicked and printing on console
@eel.expose
def generate_qr(data):
img = pyqrcode.create(data)
buffers = io.BytesIO()
img.png(buffers, scale=8)
encoded = b64encode(buffers.getvalue()).decode("ascii")
print("QR code generation successful.")
return "data:image/png;base64, " + encoded
# custom options
my_options = {
'mode': "chrome-app",
'host': 'localhost',
'port': 8080
}
# eel starting html page with this size
eel.start('index.html', size=(1000, 600))