add simple example in kivy.uix.video.py

This commit is contained in:
tshirtman 2012-11-16 14:31:56 +01:00
parent ae2c63ec33
commit 2d776364fb
1 changed files with 20 additions and 0 deletions

View File

@ -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()