Skip to content

Instantly share code, notes, and snippets.

@kived
Forked from Cheaterman/gist:04c5c8b7fba8f91615bd
Last active August 29, 2015 14:09
Show Gist options
  • Save kived/7e661b638a19cd8fd759 to your computer and use it in GitHub Desktop.
Save kived/7e661b638a19cd8fd759 to your computer and use it in GitHub Desktop.
__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:
size: self.size
Button:
text: 'Switch screen'
size_hint: 1 / 3., 1 / 5.
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
on_release:
self.parent.parent.transition.direction = 'left'
self.parent.parent.current = 'Test2'
Screen:
name: 'Test2'
canvas:
Color:
rgb: .5, .5, .5
Rectangle:
size: self.size
Button:
text: 'Switch screen'
size_hint: 1 / 3., 1 / 5.
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
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