behaviors.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:KivyNBT 作者: Kovak 项目源码 文件源码
def trigger_action(self, duration=0.1):
        '''Trigger whatever action(s) have been bound to the button by calling
        both the on_press and on_release callbacks.

        This simulates a quick button press without using any touch events.

        Duration is the length of the press in seconds. Pass 0 if you want
        the action to happen instantly.

        .. versionadded:: 1.8.0
        '''
        self._do_press()
        self.dispatch('on_press')

        def trigger_release(dt):
            self._do_release()
            self.dispatch('on_release')
        if not duration:
            trigger_release(0)
        else:
            Clock.schedule_once(trigger_release, duration)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号