當前位置: 首頁>>代碼示例>>Python>>正文


Python screenmanager.ScreenManager方法代碼示例

本文整理匯總了Python中kivy.uix.screenmanager.ScreenManager方法的典型用法代碼示例。如果您正苦於以下問題:Python screenmanager.ScreenManager方法的具體用法?Python screenmanager.ScreenManager怎麽用?Python screenmanager.ScreenManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kivy.uix.screenmanager的用法示例。


在下文中一共展示了screenmanager.ScreenManager方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: build

# 需要導入模塊: from kivy.uix import screenmanager [as 別名]
# 或者: from kivy.uix.screenmanager import ScreenManager [as 別名]
def build(self):
            Window.size = (1024, 768)
            self.sm = ScreenManager()
            self.sm.add_widget(StartScreen(name='start'))
            self.sm.add_widget(GcodeViewerScreen(name='gcode'))
            self.sm.add_widget(ExitScreen(name='main'))
            self.sm.current = 'gcode'

            level = LOG_LEVELS.get('debug') if len(sys.argv) > 2 else LOG_LEVELS.get('info')
            Logger.setLevel(level=level)
            # logging.getLogger().setLevel(logging.DEBUG)
            return self.sm 
開發者ID:wolfmanjm,項目名稱:kivy-smoothie-host,代碼行數:14,代碼來源:viewer.py

示例2: build

# 需要導入模塊: from kivy.uix import screenmanager [as 別名]
# 或者: from kivy.uix.screenmanager import ScreenManager [as 別名]
def build(self):
            # Window.size = (800, 480)
            self.sc = SpindleCamera(name='spindle camera')
            self.scr = StartScreen(name='main')
            self.sm = ScreenManager()
            self.sm.add_widget(self.scr)
            self.sm.add_widget(self.sc)
            if not self.test:
                self.sm.current = 'spindle camera'

            return self.sm 
開發者ID:wolfmanjm,項目名稱:kivy-smoothie-host,代碼行數:13,代碼來源:spindle_camera.py

示例3: init

# 需要導入模塊: from kivy.uix import screenmanager [as 別名]
# 或者: from kivy.uix.screenmanager import ScreenManager [as 別名]
def init(self):
        self.username = ''
        self.password = ''
        self.crypt_file_path = ''
        self.screenmanager = ScreenManager(transition=SwapTransition())
        self.loginscreen = LoginScreen(name='screen-login')
        self.loginscreen.bind(on_login=self.login)
        self.ideascreen = IdeaScreen(name='screen-idea')
        self.ideascreen.bind(on_quit_app=self.quit)
        self.screenmanager.add_widget(self.loginscreen)
        self.screenmanager.add_widget(self.ideascreen)
        self.screenmanager.current = 'screen-login' 
開發者ID:anselm94,項目名稱:segreto-3,代碼行數:14,代碼來源:app.py

示例4: build

# 需要導入模塊: from kivy.uix import screenmanager [as 別名]
# 或者: from kivy.uix.screenmanager import ScreenManager [as 別名]
def build(self):
		screen = ScreenManager(transition=SwapTransition())
		screen.add_widget(FirstScreen())
		screen.add_widget(SecondScreen())
		screen.add_widget(ThirdScreen())
		return screen 
開發者ID:the-duck,項目名稱:launcher,代碼行數:8,代碼來源:main.py

示例5: __init__

# 需要導入模塊: from kivy.uix import screenmanager [as 別名]
# 或者: from kivy.uix.screenmanager import ScreenManager [as 別名]
def __init__(self, **kwargs):
        super(FileChooser, self).__init__(**kwargs)

        self.manager = ScreenManager()
        super(FileChooser, self).add_widget(self.manager)

        self.trigger_update_view = Clock.create_trigger(self.update_view)

        self.bind(view_mode=self.trigger_update_view) 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:11,代碼來源:filechooser.py

示例6: test_card_screen_empty

# 需要導入模塊: from kivy.uix import screenmanager [as 別名]
# 或者: from kivy.uix.screenmanager import ScreenManager [as 別名]
def test_card_screen_empty():
    """
    Ensure a relatively empty card results in the expected Screen object and
    the passed in ScreenManager instance and data_store is set for the card.
    """
    mock_screen_manager = mock.MagicMock()
    data_store = {"foo": "bar"}
    card = Card("title")
    result = card.screen(mock_screen_manager, data_store)
    assert card.screen_manager == mock_screen_manager
    assert card.data_store == data_store
    assert isinstance(result, Screen) 
開發者ID:ntoll,項目名稱:pypercard,代碼行數:14,代碼來源:test_core.py

示例7: test_cardapp_init_no_data_store

# 需要導入模塊: from kivy.uix import screenmanager [as 別名]
# 或者: from kivy.uix.screenmanager import ScreenManager [as 別名]
def test_cardapp_init_no_data_store():
    """
    Ensure the CardApp instance is set up with the expected defaults.
    """
    app = CardApp()
    assert app.data_store == {}
    assert app.cards == {}
    assert isinstance(app.screen_manager, ScreenManager)
    assert app.title == "A PyperCard Application :-)" 
開發者ID:ntoll,項目名稱:pypercard,代碼行數:11,代碼來源:test_core.py

示例8: test_cardapp_init_title_datastore_and_stack

# 需要導入模塊: from kivy.uix import screenmanager [as 別名]
# 或者: from kivy.uix.screenmanager import ScreenManager [as 別名]
def test_cardapp_init_title_datastore_and_stack():
    """
    Ensure the CardApp instance is set up with the expected user defined
    values.
    """
    stack = [Card("test")]
    app = CardApp("An App", {"foo": "bar"}, stack)
    assert app.data_store == {"foo": "bar"}
    assert app.cards == {"test": stack[0]}
    assert isinstance(app.screen_manager, ScreenManager)
    assert app.title == "An App" 
開發者ID:ntoll,項目名稱:pypercard,代碼行數:13,代碼來源:test_core.py

示例9: test_cardapp_build

# 需要導入模塊: from kivy.uix import screenmanager [as 別名]
# 或者: from kivy.uix.screenmanager import ScreenManager [as 別名]
def test_cardapp_build():
    """
    Ensure the screen_manager instance is returned to display as the
    application.
    """
    app = CardApp()
    assert isinstance(app.build(), ScreenManager) 
開發者ID:ntoll,項目名稱:pypercard,代碼行數:9,代碼來源:test_core.py

示例10: screen

# 需要導入模塊: from kivy.uix import screenmanager [as 別名]
# 或者: from kivy.uix.screenmanager import ScreenManager [as 別名]
def screen(self, screen_manager, data_store):
        """
        Return a screen instance containing all the necessary UI items that
        have been associated with the expected event handlers.

        :param kivy.uix.screenmanager.ScreenManager screen_manager: The UI
            stack of screens which controls which card is to be displayed.
        :param dict data_store: A dictionary containing application state.
        :return: A graphical representation of the card.
        """
        # References to app related objects.
        self.screen_manager = screen_manager
        self.data_store = data_store
        # The Kivy Screen instance used to draw the UI.
        screen = Screen(name=self.title)
        # Bind event handlers to life-cycle events.
        screen.bind(on_enter=self._enter)
        screen.bind(on_pre_enter=self._pre_enter)
        screen.bind(on_pre_leave=self._leave)
        # The main layout that defines how UI elements are drawn.
        self.layout = BoxLayout(orientation="vertical")
        screen.add_widget(self.layout)
        # The sound player for this card.
        self.player = None
        # Text font size for the Screen instance.
        self.font_size = "{}sp".format(self.text_size)
        if self.form:
            self._draw_form()
        elif self.text:
            self._draw_text()
        else:
            # For padding purposes.
            self.layout.add_widget(Label(text=" "))
        if self.sound:
            self.player = SoundLoader.load(self.sound)
            self.player.loop = self.sound_repeat
        if self.background:
            self.layout.bind(size=self._update_rect, pos=self._update_rect)
            with self.layout.canvas.before:
                if isinstance(self.background, tuple):
                    Color(*self.background)
                    self.rect = Rectangle(
                        size=self.layout.size, pos=self.layout.pos
                    )
                else:
                    self.rect = Rectangle(
                        source=self.background,
                        size=self.layout.size,
                        pos=self.layout.pos,
                    )
        if self.buttons:
            self._draw_buttons()
        return screen 
開發者ID:ntoll,項目名稱:pypercard,代碼行數:55,代碼來源:core.py


注:本文中的kivy.uix.screenmanager.ScreenManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。