-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
56 lines (38 loc) · 1.35 KB
/
main.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
import qrcode
# from kivymd.uix.button import MDRectangleFlatButton
from kivy.core.window import Window
from kivymd.app import MDApp
from kivy.uix.screenmanager import Screen, FadeTransition, ScreenManager
from kivy.lang import Builder
from kivy.uix.image import Image
import plyer
import time
# from PIL import Image
Window.size = 320, 550
class Function(ScreenManager):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def generate_qr_code(self, root):
code = qrcode.QRCode(version=1.00, box_size=15, border=4)
code.add_data(self.ids.link_text.text)
code.make(fit=True)
img = code.make_image(fill='Black', back_color='White')
img.save(f"{self.ids.image_name.text}.png")
def make_another(self, root):
self.ids.link_text.text = ''
self.ids.image_name.text = ''
root.current = 'first'
def view_image(self, root):
self.ids.img_.source = f'{self.ids.image_name.text}.png'
time.sleep(0.5)
root.current = 'Result'
class MainApp(MDApp):
def build(self):
Builder.load_file('layout.kv')
self.theme_cls.primary_palette = 'Green'
return Function()
def show_notification(self):
plyer.notification.notify(
title='QR Code generator', message="Qr code created")
if __name__ == '__main__':
MainApp().run()