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


Python BaseWidget.set_focus方法代码示例

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


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

示例1: set_focus

# 需要导入模块: from BaseWidget import BaseWidget [as 别名]
# 或者: from BaseWidget.BaseWidget import set_focus [as 别名]
    def set_focus (self, focus=True):
        """E.set_focus (...) -> bool
        
        Sets the input and action focus of the Editable.
        
        Sets the input and action focus of the Editable and returns True
        upon success or False, if the focus could not be set.

        Note: This method only works as supposed using
        a render loop, which supports the Renderer class specification.
        """
        if not self.sensitive:
            return False
        
        BaseWidget.set_focus (self, focus)
        if focus:
            # Save the text after activation and reset the caret blink
            # effects.
            self._caret_visible = True
            self._temp = self.text
            self._caret_visible = True
            self._counter = 0
            self.state = STATE_ACTIVE
        elif self._temp != self.text:
            # If the Editable looses its input focus _and_ has changed text,
            # it will be validated by default.
            if base.debug: print "Editable.INPUT"
            self._temp = self.text
            self.state = STATE_NORMAL
            self.run_signal_handlers (SIG_INPUT)
        else:
            # The Editable looses its input focus without any change.
            self.state = STATE_NORMAL
            self._caret = 0
        return True
开发者ID:UncommonAvenue,项目名称:mm-x-ctf,代码行数:37,代码来源:Editable.py


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