Created
November 12, 2014 20:27
-
-
Save Cheaterman/04c5c8b7fba8f91615bd 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
__author__ = 'Cheaterman' | |
from kivy.app import App | |
from kivy.uix.screenmanager import ScreenManager | |
from kivy.lang import Builder | |
kv = """ | |
<TestWidget>: | |
Screen: | |
name: 'Test1' | |
canvas: | |
Color: | |
rgb: 1, 1, 1 | |
Rectangle: | |
pos: self.pos | |
size: self.size | |
Button: | |
text: 'Switch screen' | |
size_hint: 1 / 3., 1 / 5. | |
center: self.parent.center | |
on_release: | |
self.parent.parent.transition.direction = 'left' | |
self.parent.parent.current = 'Test2' | |
Screen: | |
name: 'Test2' | |
canvas: | |
Color: | |
rgb: .5, .5, .5 | |
Rectangle: | |
pos: self.pos | |
size: self.size | |
Button: | |
text: 'Switch screen' | |
size_hint: 1 / 3., 1 / 5. | |
center: self.parent.center | |
on_release: | |
self.parent.parent.transition.direction = 'right' | |
self.parent.parent.current = 'Test1' | |
""" | |
Builder.load_string(kv) | |
class TestWidget(ScreenManager): | |
pass | |
class TestApp(App): | |
def build(self): | |
return TestWidget() | |
if __name__ == '__main__': | |
TestApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment