File: main.py

package info (click to toggle)
python-plyer 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,724 kB
  • sloc: python: 13,395; sh: 217; makefile: 177
file content (46 lines) | stat: -rw-r--r-- 743 bytes parent folder | download | duplicates (2)
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
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from plyer import flash

Builder.load_string('''
<FlashInterface>:
    Button:
        text: "Turn On"
        on_release: root.turn_on()

    Button:
        text: "Turn off"
        on_release: root.turn_off()

    Button:
        text: "Release"
        on_release: root.release()

''')


class FlashInterface(BoxLayout):

    def turn_on(self):
        flash.on()

    def turn_off(self):
        flash.off()

    def release(self):
        flash.release()


class FlashApp(App):

    def build(self):
        return FlashInterface()

    def on_pause(self):
        return True


if __name__ == "__main__":
    app = FlashApp()
    app.run()