Skip to content

Instantly share code, notes, and snippets.

@KristerV
Last active December 14, 2015 11:09
Show Gist options
  • Save KristerV/5077532 to your computer and use it in GitHub Desktop.
Save KristerV/5077532 to your computer and use it in GitHub Desktop.
bug report for kivy - ScrollView.bind(scroll_y=x)
from kivy.lang import Builder
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.scrollview import ScrollView
from kivy.uix.label import Label
from kivy.clock import Clock
class TestApp(App):
def build(self):
self.box = BoxLayout()
# kanalid = BoxLayout()
self.vasak_kast = ScrollView(size_hint = (None,1), size_x=150)
self.parem_kast = ScrollView()
self.vasak_kast.bind(scroll_y=self.parem_kast.scroll_y)
self.grid_vasak = GridLayout(size_hint = (1,3), cols=1)
self.grid_parem = GridLayout(size_hint = (1,3), cols=1)
self.box.add_widget(self.vasak_kast)
self.box.add_widget(self.parem_kast)
self.vasak_kast.add_widget(self.grid_vasak)
self.parem_kast.add_widget(self.grid_parem)
self.grid_vasak.add_widget(Label(text='Logod'))
self.grid_parem.add_widget(Label(text='Kanalid'))
self.vasak_kast.bind(scroll_y=self.parem_kast.scroll_y)
Clock.schedule_interval(self.print_scrolls, 1)
for i in range(20):
self.grid_parem.add_widget(Button(text='kanal %s'%i))
for i in range(20):
self.grid_vasak.add_widget(Button(text='Pilt %s'%i))
return self.box
def print_scrolls(self, arg1):
print '-------------------------'
print self.parem_kast.scroll_y
print self.vasak_kast.scroll_y
if __name__ == '__main__':
TestApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment