コード例 #1
0
ファイル: main.py プロジェクト: Rinatum/DMD
    def build(self):
        sm = sp.ScreenManager()
        Main.input_screen = InputScreen(name='input')
        Main.plot_screen = PlotScreen(name='Plot')
        Main.error_screen = ErrorScreen(name='error')
        sm.add_widget(Main.input_screen)
        sm.add_widget(Main.plot_screen)
        sm.add_widget(Main.error_screen)

        return sm
コード例 #2
0
def test_switch_to():
    import kivy.uix.screenmanager as sm
    manager = sm.ScreenManager()
    screen1 = sm.Screen(name='first')
    screen2 = sm.Screen(name='second')
    manager.switch_to(screen1)
    manager.switch_to(screen2)
    manager.switch_to(screen1)
    manager.switch_to(screen2)
    manager.current = 'first'
    manager.switch_to(screen1)
    manager.current = 'second'
    manager.switch_to(screen2)
コード例 #3
0
def test_switching_does_not_affect_a_list_of_screens(transition_cls_name):
    import kivy.uix.screenmanager as sm
    transition_cls = getattr(sm, transition_cls_name)
    scrmgr = sm.ScreenManager()
    for i in range(3):
        scrmgr.add_widget(sm.Screen(name=str(i)))
    names = list(scrmgr.screen_names)
    scrmgr.transition = transition_cls()
    scrmgr.current = '1'
    assert names == scrmgr.screen_names
    scrmgr.transition = transition_cls()
    scrmgr.current = '2'
    assert names == scrmgr.screen_names
コード例 #4
0
	def generate_screens(self):
		"""Screens are generated here, in the start of the program. Initializing them will run __init__ as usual, then added to g.screen. As it happens, some things cannot be made in advance, because they depend on user input during the program (e.g. adding option buttons). These are handled in the function 'pre_enter', present in every screen."""

		g.manager = screenmanager.ScreenManager(transition = screenmanager.SwapTransition())

		g.screens['splash'] = screen_splash.splashScreen(name = 'splash_screen')
		g.screens['main'] = screen_main.mainScreen(name = 'main_screen')
		g.screens['title'] = screen_title.titleScreen(name = 'title_screen')
		g.screens['tutorial'] = screen_tutorial.tutorialScreen(name = 'tutorial')
		g.screens['more'] = screen_more.moreScreen(name = 'more')

		g.manager.add_widget(g.screens['splash'])
		g.manager.add_widget(g.screens['main'])
		g.manager.add_widget(g.screens['title'])
		g.manager.add_widget(g.screens['tutorial'])
		g.manager.add_widget(g.screens['more'])
コード例 #5
0
ファイル: main.py プロジェクト: 2x-life/doublelife_gamebook
 def build(self):
     kv_config.Config.set('graphics', 'width', '450')
     kv_config.Config.set('graphics', 'height', '800')
     sm = kv_screenmanager.ScreenManager()
     sm.add_widget(menu.MenuScreen(name='menu'))
     return sm