Created
August 31, 2013 12:29
-
-
Save inclement/6397905 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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