Undefined
By: Guest | Date: Sep 18 2016 03:59 | Format: Python | Expires: never | Size: 1.58 KB | Hits: 742
- from kivy.app import App
- from kivy.core.window import Window
- from kivy.uix.screenmanager import ScreenManager, Screen, WipeTransition
- from kivy.properties import ObjectProperty
- from kivy.lang import Builder
- from kivy.properties import StringProperty
- from kivy.modules import inspector
- from kivy.uix.popup import Popup
- from kivy.uix.button import Button
- from kivy.uix.label import Label
- from kivy.uix.gridlayout import GridLayout
- class TitleScreen(Screen):
- def on_pre_enter(self):
- self.ids.grid.add_widget(Label(text="I'm a widget"))
- class Manager(ScreenManager):
- MainMenu_Screen = ObjectProperty(None)
- class ScreensApp(App):
- def build(self):
- m = Manager(transition=WipeTransition())
- m.current = 'TitleScreen'
- inspector.create_inspector(Window, m)
- return m
- if __name__ == "__main__":
- app = ScreensApp()
- app.run()
- ====================================
- <TitleScreen>:
- ScrollView:
- GridLayout:
- id: grid
- cols: 1
- padding: 10
- spacing: 10
- size_hint_y: None
- do_scroll_x: True
- height: self.minimum_height
- Button:
- text: 'Refresh'
- size_hint_x: .1
- size_hint_y: .1
- on_press: root.manager.current = 'TitleScreen'
- size_hint_y: None
- <Manager>:
- id: screen_manager
- title_screen: title_screen
- TitleScreen:
- id: title_screen
- name: 'TitleScreen'
- manager: screen_manager
Latest pastes
3 hours ago
1 days ago
1 days ago
2 days ago
2 days ago