Debian Codegraph @

examples/flash/main.py

raw symbols SCIP
1 from kivy.app import App
2 from kivy.uix.boxlayout import BoxLayout
3 from kivy.lang import Builder
4 from plyer import flash
5
6 Builder.load_string('''
7 <FlashInterface>:
8 Button:
9 text: "Turn On"
10 on_release: root.turn_on()
11
12 Button:
13 text: "Turn off"
14 on_release: root.turn_off()
15
16 Button:
17 text: "Release"
18 on_release: root.release()
19
20 ''')
21
22
23 class FlashInterface(BoxLayout):
24
25 def turn_on(self):
26 flash.on()
27
28 def turn_off(self):
29 flash.off()
30
31 def release(self):
32 flash.release()
33
34
35 class FlashApp(App):
36
37 def build(self):
38 return FlashInterface()
39
40 def on_pause(self):
41 return True
42
43
44 if __name__ == "__main__":
45 app = FlashApp()
46 app.run()