mirror of https://github.com/kivy/kivy.git
add simple example in kivy.uix.video.py
This commit is contained in:
parent
ae2c63ec33
commit
2d776364fb
|
@ -195,3 +195,23 @@ class Video(Image):
|
|||
def on_volume(self, instance, value):
|
||||
if self._video:
|
||||
self._video.volume = value
|
||||
|
||||
if __name__ == '__main__':
|
||||
from kivy.app import App
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print "usage: %s file" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
class VideoApp(App):
|
||||
def build(self):
|
||||
self.v = Video(source=sys.argv[1], state='play')
|
||||
self.v.bind(state=self.replay)
|
||||
return self.v
|
||||
|
||||
def replay(self, *args):
|
||||
if self.v.state == 'stop':
|
||||
self.v.state = 'play'
|
||||
|
||||
VideoApp().run()
|
||||
|
|
Loading…
Reference in New Issue