Last active
December 14, 2015 03:29
-
-
Save MightyThor/5021372 to your computer and use it in GitHub Desktop.
This file contains 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.lang import Builder | |
from kivy.uix.screenmanager import ScreenManager, Screen | |
# Declare both screen | |
class MenuScreen(Screen): | |
def returnstring(self, printstring): | |
print printstring | |
pass | |
class SettingsScreen(Screen): | |
pass | |
class ScreenManagerApp(App): | |
def build(self): | |
sm = ScreenManager() | |
sm.add_widget(MenuScreen(name='menu')) | |
sm.add_widget(SettingsScreen(name='settings')) | |
return sm | |
if __name__ == '__main__': | |
ScreenManagerApp().run() | |
This file contains 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 | |
<MenuScreen>: | |
BoxLayout: | |
Button: | |
text: 'Goto settings' | |
on_press: txt_input.focus = False, root.returnstring(txt_input.text) | |
Button: | |
text: 'Quit' | |
TextInput: | |
id: txt_input | |
multiline: False | |
<SettingsScreen>: | |
BoxLayout: | |
Button: | |
text: 'My setting button' | |
Button: | |
text: 'Back to menu' | |
on_press: root.manager.current = 'menu' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment