--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import kivy
kivy.require('1.8.0')
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import ObjectProperty, ListProperty, StringProperty
from kivy.uix.button import Button
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.video import Video
from kivy.uix.scrollview import ScrollView
from kivy.uix.listview import ListItemButton, ListView
from kivy.factory import Factory
from kivy.adapters.listadapter import ListAdapter
Builder.load_string("""
#:kivy 1.8
#:import ListAdapter kivy.adapters.listadapter.ListAdapter
#:import Factory kivy.factory.Factory
<ExampleListItem>:
height: '70sp'
size_hint_y: None
BoxLayout:
Button:
text: root.example_title
on_press: app.root.examplevideo.source = root.example_url
<ExampleListView>:
adapter: ListAdapter(data=app.data, cls=Factory.ExampleListItem, args_converter=root.args_converter)
<SomeOtherClass>:
""")
class ExampleListItem(BoxLayout):
example_title = StringProperty()
example_url = StringProperty()
class ExampleListView(ListView):
def args_converter(self, row_index, item):
return {'example_index': row_index, 'example_title': item['title'], 'example_url': item['url']}
class SomeOtherClass(FloatLayout):
examplevideo = ObjectProperty(None)
class ExampleApp(App):
data = ListProperty([
{'title': 'I am a Sample Button', 'url': 'https://archive.org/download/ThemeFromShafthip-hopRemixVideo/ThemeFromShaftb-boyRemix_512kb.mp4'},
{'title': 'No I am a Sample Button', 'url': 'https://archive.org/download/BADmichaeljackson/brandon_512kb.mp4'},
{'title': 'Bro R U SRS', 'url': 'https://archive.org/download/WeEditLife/WeEditLife_512kb.mp4'},
{'title': 'I R Button', 'url': 'https://archive.org/download/ThemeFromShafthip-hopRemixVideo/ThemeFromShaftb-boyRemix_512kb.mp4'},
{'title': 'Leave me out of this', 'url': 'https://archive.org/download/BADmichaeljackson/brandon_512kb.mp4'},
{'title': 'Me too', 'url': 'https://archive.org/download/WeEditLife/WeEditLife_512kb.mp4'},
{'title': 'BUTTON PARTY', 'url': 'https://archive.org/download/ThemeFromShafthip-hopRemixVideo/ThemeFromShaftb-boyRemix_512kb.mp4'},
{'title': 'The end of the button road', 'url': 'https://archive.org/download/BADmichaeljackson/brandon_512kb.mp4'}
])
def build(self):
if __name__ == '__main__':
ExampleApp().run()import kivy
kivy.require('1.8.0')
from kivy.app import Appfrom kivy.lang import Builderfrom kivy.properties import ObjectProperty, ListProperty, StringPropertyfrom kivy.uix.button import Buttonfrom kivy.uix.floatlayout import FloatLayoutfrom kivy.uix.boxlayout import BoxLayoutfrom kivy.uix.video import Videofrom kivy.uix.scrollview import ScrollViewfrom kivy.uix.listview import ListItemButton, ListViewfrom kivy.factory import Factoryfrom kivy.adapters.listadapter import ListAdapter
class ExampleListItem(BoxLayout): example_title = StringProperty() example_url = StringProperty() class ExampleListView(ListView): def args_converter(self, row_index, item): return {'example_index': row_index, 'example_title': item['title'], 'example_url': item['url']} class SomeOtherClass(FloatLayout): examplevideo = ObjectProperty(None)
Builder.load_string("""
#:kivy 1.8#:import ListAdapter kivy.adapters.listadapter.ListAdapter#:import Factory kivy.factory.Factory
<ExampleListItem>: height: '70sp' size_hint_y: None
BoxLayout: Button: text: root.example_title on_press: app.root.examplevideo.source = root.example_url
<ExampleListView>: adapter: ListAdapter(data=app.data, cls=Factory.ExampleListItem, args_converter=root.args_converter)
<SomeOtherClass>: examplevideo: examplevideo ScrollView: id: scroller size_hint: (.5, .65) pos_hint: {'center_x': .25, 'center_y': .575} do_scroll_x: 'False' ExampleListView Video: id: examplevideo source: '' state: 'play' size_hint: (.4, .4) pos_hint: {'center_x': .75, 'center_y': .625}
""")
class ExampleApp(App):
data = ListProperty([ {'title': 'I am a Sample Button', 'url': 'https://archive.org/download/ThemeFromShafthip-hopRemixVideo/ThemeFromShaftb-boyRemix_512kb.mp4'}, {'title': 'No I am a Sample Button', 'url': 'https://archive.org/download/BADmichaeljackson/brandon_512kb.mp4'}, {'title': 'Bro R U SRS', 'url': 'https://archive.org/download/WeEditLife/WeEditLife_512kb.mp4'}, {'title': 'I R Button', 'url': 'https://archive.org/download/ThemeFromShafthip-hopRemixVideo/ThemeFromShaftb-boyRemix_512kb.mp4'}, {'title': 'Leave me out of this', 'url': 'https://archive.org/download/BADmichaeljackson/brandon_512kb.mp4'}, {'title': 'Me too', 'url': 'https://archive.org/download/WeEditLife/WeEditLife_512kb.mp4'}, {'title': 'BUTTON PARTY', 'url': 'https://archive.org/download/ThemeFromShafthip-hopRemixVideo/ThemeFromShaftb-boyRemix_512kb.mp4'}, {'title': 'The end of the button road', 'url': 'https://archive.org/download/BADmichaeljackson/brandon_512kb.mp4'} ]) def build(self): self.root = SomeOtherClass() return self.root