Skip to content

Instantly share code, notes, and snippets.

@mike-perdide
Created November 22, 2012 17:34
Show Gist options
  • Select an option

  • Save mike-perdide/4132316 to your computer and use it in GitHub Desktop.

Select an option

Save mike-perdide/4132316 to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.tabbedpanel import TabbedPanel
Builder.load_string("""
<TabbedPanelContent>
canvas:
Color:
rgba: root.parent.custom_color
Rectangle:
size: self.size
pos: self.pos
<TestWidget>
do_default_tab: False
label1: label1
custom_color: .4, .4, .7, 1
Label:
id: label1
text: "hello"
TabbedPanelHeader:
id: header_one
content: label1
""")
class TestWidget(TabbedPanel):
def __init__(self):
TabbedPanel.__init__(self)
print self.content.parent
self.bind(on_touch_down=self.print_parent)
def print_parent(self, obj, event):
print self.content.parent
class TestApp(App):
def build(self):
widget = TestWidget()
return widget
if __name__ == "__main__":
TestApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment