I'm just trying to create a simple screen that contains a Navigation bar at the top, and a scrolling list at the bottom. When i run the bottom code, i get a "KeyError". Could someone please help me identify where the gap in my understanding is?
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.lang import Builder
from kivy.properties import ObjectProperty
Builder.load_string("""
#:import ScrollView kivy.uix.scrollview
#:import SlideTransition kivy.uix.screenmanager.SlideTransition
<NavBar>:
BoxLayout:
orientation: 'horizontal'
Button:
font_size: 42
size_hint: .5, 1
text: 'Edit'
Button:
font_size: 42
size_hint: .5, 1
text: 'Settings'
<ScrollButton>
size_hint: None, None
size: 640, 88
<Scroller>:
ScrollView:
size_hint: None, None
GridLayout:
cols: 1
height: self.minimum_height
do_scroll_x: False
id: container
<ListsScreen>:
nb: navbar
sc: scroller
canvas:
Color:
rgb: .50, .50, .30
Rectangle:
size: self.size
pos: self.pos
BoxLayout:
height: self.parent.height
pos_hint: {'top': (1-(20/480))}
orientation: 'vertical'
NavBar:
id: navbar
pos_hint: {'top': 1}
size_hint: 1, (88/1136)
Scroller:
id: scroller
pos: {'top': (1-(128/1136))}
""")
class NavBar(Widget):
pass
class ScrollButton(Button):
pass
class Scroller(Widget):
container = ObjectProperty(None)
class ListsScreen(Screen):
nb = ObjectProperty(None)
sc = ObjectProperty(None)
class TestApp(App):
def build(self):
''''''
root = super(TestApp, self).build()
container = root.ids['container']()
for i in xrange(30):
container.add_widget(ScrollButton(text=str(i)))
out = ScreenManager()
out.add_widget(ListsScreen(name='Insert Name Here'))
return out
if __name__ == '__main__':
TestApp().run()