Last active
December 14, 2015 04:09
-
-
Save MightyThor/5026238 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
#:kivy 1.5.1 | |
#:import kivy kivy | |
<ScreenOne>: | |
GridLayout: | |
size: root.size | |
rows: 3 | |
Label: | |
text: 'Screen One' | |
TextInput: | |
id: text_screen_one | |
Button: | |
text: 'Go to Screen Two' | |
on_press: app.thestring = text_screen_one.text; root.manager.current = 'screentwo' | |
<ScreenTwo>: | |
GridLayout: | |
size: root.size | |
rows: 3 | |
Label: | |
text: 'Screen Two' | |
TextInput: | |
id: text_screen_two | |
text: app.thestring | |
focus: True | |
Button: | |
text: 'Go to Screen One' | |
on_press: root.manager.current = 'screenone' |
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
from kivy.app import App | |
from kivy.properties import StringProperty | |
from kivy.uix.screenmanager import ScreenManager, Screen | |
class ScreenOne(Screen): | |
pass | |
class ScreenTwo(Screen): | |
pass | |
class PassingDataBetweenScreensApp(App): | |
thestring = StringProperty('') | |
def build(self): | |
sm = ScreenManager() | |
sm.add_widget(ScreenOne(name='screenone')) | |
sm.add_widget(ScreenTwo(name='screentwo')) | |
return sm | |
if __name__ == '__main__': | |
PassingDataBetweenScreensApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment