Skip to content

Instantly share code, notes, and snippets.

@inclement
Created August 31, 2013 12:29
Show Gist options
  • Select an option

  • Save inclement/6397905 to your computer and use it in GitHub Desktop.

Select an option

Save inclement/6397905 to your computer and use it in GitHub Desktop.
in kv:
<CustomWidget1>:
id: custom_widget_1
size_hint_y: None
height: 0
<CustomWidget2>:
size_hint_y: None
Button:
on_press: root.other_widget.call()
in main.py:
class CustomWidget1(BoxLayout):
def call(self):
print('test')
class CustomWidget2(BoxLayout):
other_widget = ObjectProperty(None)
class ExampleApp(App):
def build(self):
wid1 = CustomWidget1()
wid2 = CustomWidget2()
wid2.other_widget = wid1
s = ScreenManager()
s1 = Screen()
s1.add_widget(wid1)
s2 = Screen()
s2.add_widget(wid2)
return s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment