Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Created July 14, 2012 14:15
Show Gist options
  • Select an option

  • Save tshirtman/3111548 to your computer and use it in GitHub Desktop.

Select an option

Save tshirtman/3111548 to your computer and use it in GitHub Desktop.
from kivy.uix.widget import Widget
from kivy.uix.gridlayout import GridLayout as MyGridLayout
from kivy.uix.scrollview import ScrollView as MyScrollView
from kivy.uix.label import Label as YourWidget
from kivy.core.window import Window
from kivy.app import App
class Pathways(Widget):
def __init__(self, **kwargs):
super(Pathways, self).__init__(**kwargs)
self.layoutMain = MyGridLayout(cols=1, spacing=1, size_hint=(None, None), width=400)
self.layoutMain.bind(minimum_height=self.layoutMain.setter('height'))
self.layoutChose = MyGridLayout(cols=1, spacing=1, size_hint=(None, None), width=400)
self.layoutChose.bind(minimum_height=self.layoutChose.setter('height'))
for i in range(30):
btn = YourWidget(text='[color=000000]' + str(i) + 'Hello World[/color]', markup=True, size=(400, 20), size_hint=(None, None))
self.layoutMain.add_widget(btn)
self.troot = MyScrollView(size_hint=(None, None))
self.troot.size = (400, 320)
self.troot.center = 300, Window.height - 300
self.troot.add_widget(self.layoutMain)
self.troot2 = MyScrollView(size_hint=(None, None))
self.troot2.size = (400, 320)
self.troot2.center = 750, Window.height - 300
self.troot2.add_widget(self.layoutChose)
self.add_widget(self.troot2)
self.add_widget(self.troot)
self.layoutMain.bind(on_touch_up=self.moveChild)
self.layoutChose.bind(on_touch_up=self.moveChild)
def moveChild(self, *args):
print args
class MyApp(App):
def build(self):
return Pathways()
if __name__ == '__main__':
MyApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment