当前位置: 首页>>代码示例>>Python>>正文


Python Screen.bind方法代码示例

本文整理汇总了Python中kivy.uix.screenmanager.Screen.bind方法的典型用法代码示例。如果您正苦于以下问题:Python Screen.bind方法的具体用法?Python Screen.bind怎么用?Python Screen.bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kivy.uix.screenmanager.Screen的用法示例。


在下文中一共展示了Screen.bind方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build

# 需要导入模块: from kivy.uix.screenmanager import Screen [as 别名]
# 或者: from kivy.uix.screenmanager.Screen import bind [as 别名]
    def build(self):
        # initialize logger
        #KL.start([DataMode.file, DataMode.communication]) #, "/sdcard/curiosity/", the_ip='127.0.0.1')#self.user_data_dir)
        KL.start([DataMode.file, DataMode.communication, DataMode.ros], self.user_data_dir)

        self.cg = CuriosityGame(self)
        self.cf = ConsentForm(self)

        self.cei2 = CEI2()
        self.qf = []
        for p in range(0, len(self.cei2.page_dict)):
            self.qf.append(QuestionsForm(self, self.cei2.page_dict[p]))

        self.learn = Learning(self)
        self.lf = [LearningForm(self), LearningForm(self)]

        self.df = DetailsForm(self)
        self.ff = FinalForm(self)

        self.score = CuriosityScore(self.cg.game_duration,
                                    len(self.cg.items),
                                    self.user_data_dir)

        self.sm = ScreenManager()

        screen = Screen(name='consent')
        screen.add_widget(self.cf)
        self.sm.add_widget(screen)

        screen = Screen(name='thegame')
        screen.add_widget(self.cg.the_widget)
        self.sm.add_widget(screen)

        for kqf in range(0, len(self.qf)):
            screen = Screen(name="question"+str(kqf))
            screen.add_widget(self.qf[kqf])
            self.sm.add_widget(screen)

        screen = Screen(name="learning_0")
        screen.add_widget(self.lf[0])
        screen.bind(on_pre_enter=self.learn.start)
        self.sm.add_widget(screen)

        screen = Screen(name="learning_1")
        screen.add_widget(self.lf[1])
        self.sm.add_widget(screen)

        screen = Screen(name="details")
        screen.add_widget(self.df)
        self.sm.add_widget(screen)

        screen = Screen(name="final")
        screen.bind(on_enter=self.ff.start)
        screen.add_widget(self.ff)
        self.sm.add_widget(screen)

        self.start()
        return self.sm
开发者ID:curiosity-lab,项目名称:cg_thegame3,代码行数:60,代码来源:main.py

示例2: build

# 需要导入模块: from kivy.uix.screenmanager import Screen [as 别名]
# 或者: from kivy.uix.screenmanager.Screen import bind [as 别名]
    def build(self):
        if (not self.is_desktop()):
            Config.set('postproc', 'retain_time', '10')
            Config.set('postproc', 'double_tap_time', '1')
            Config.set('postproc', 'triple_tap_time', '2')
            Config.set('graphics', 'fullscreen', 'auto')
            Config.write()

        ##################################

        platform = kivy.utils.platform()

        ##################################
        # Start screen
        ##################################
        start_screen = Screen(name='start')
        start_screen.bind(on_pre_enter=self.generate_start_screen)
        
        ##################################
        # Card screen
        ##################################
        card_layout = BoxLayout(orientation='vertical',size_hint=(1,.95))
        card_widget = BoxLayout(size_hint=(1,.85))
        card_buttons_widget = BoxLayout(size_hint=(1,.15))

        self.card_label = Label(markup=True, pos=(0,0), font_name='img/ipag.ttf',
                                font_size=64, halign="center", valign="top")
        self.card_label.bind(on_touch_down=self.on_card_press)
        card_widget.add_widget(self.card_label)

        again_btn = Button(markeup=True)
        again_btn.text = "again"
        again_btn.bind(on_press=self.process_card_btn)
        card_buttons_widget.add_widget(again_btn)

        soon_btn = Button(markeup=True)
        soon_btn.text = "soon"
        soon_btn.bind(on_press=self.process_card_btn)
        card_buttons_widget.add_widget(soon_btn)

        later_btn = Button(markeup=True)
        later_btn.text = "later"
        later_btn.bind(on_press=self.process_card_btn)
        card_buttons_widget.add_widget(later_btn)

        never_btn = Button(markeup=True)
        never_btn.text = "never"
        never_btn.bind(on_press=self.process_card_btn)
        card_buttons_widget.add_widget(never_btn)

        card_layout.add_widget(card_widget)
        card_layout.add_widget(card_buttons_widget)

        card_screen = Screen(name='main')
        card_screen.add_widget(card_layout)
        card_screen.bind(on_enter=self.card_refresh)

        ##################################
        # Settings screen
        ##################################
        settings_screen = SettingsScreen(name='settings')
        settings_screen.add_widget(self.generate_settings())

        ##################################
        # No more cards screen
        ##################################

        no_more_layout = BoxLayout(size_hint=(1,1), orientation='vertical')
        no_more_label = Label(markup=True, pos=(0,0), font_name='img/ipag.ttf', size_hint=(1,.85),
                              font_size=64, halign="center", text="No more cards to review.")
        no_more_layout.add_widget(no_more_label)
        no_more_btn_layout = BoxLayout(size_hint=(1,.15))

        no_more_home_btn = Button(markup=True)
        no_more_home_btn.text = "Home"
        no_more_home_btn.bind(on_press=self.go_to_start_screen)
        no_more_btn_layout.add_widget(no_more_home_btn)

        no_more_exit_btn = Button(markup=True)
        no_more_exit_btn.text = "Done"
        no_more_exit_btn.bind(on_press=sys.exit)
        no_more_btn_layout.add_widget(no_more_exit_btn)

        no_more_layout.add_widget(no_more_btn_layout)

        no_more_screen = Screen(name='finished')
        no_more_screen.add_widget(no_more_layout)

        import_layout = BoxLayout(size_hint=(1,1), orientation='vertical')
        self.import_msg_label = Label(markup=True, pos=(0,0), font_name = 'img/ipag.ttf', size_hint=(1,.1),
                                      font_size=24, halign='left', text='Please select a .tsv file.')
        import_layout.add_widget(self.import_msg_label)        

        #TODO P3: Can we increase text size?
        import_file_chooser = FileChooserListView(on_submit=self.import_list, path='/')
        import_file_chooser.bind(selection=self.import_list)
        import_layout.add_widget(import_file_chooser)

        import_cancel_button = Button(text="Cancel", on_press=self.go_to_start_screen, size_hint=(1,.15))
        import_layout.add_widget(import_cancel_button)
#.........这里部分代码省略.........
开发者ID:btrent,项目名称:qflash,代码行数:103,代码来源:main.py


注:本文中的kivy.uix.screenmanager.Screen.bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。