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


Python CompositeCanvas.cursor方法代码示例

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


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

示例1: render

# 需要导入模块: from urwid.canvas import CompositeCanvas [as 别名]
# 或者: from urwid.canvas.CompositeCanvas import cursor [as 别名]
    def render(self, size, focus=False):
        """
        Render the text content of this widget with a cursor when
        in focus.

        >>> si = SelectableIcon(u"[!]")
        >>> si
        <SelectableIcon selectable flow widget '[!]'>
        >>> si.render((4,), focus=True).cursor
        (1, 0)
        >>> si = SelectableIcon("((*))", 2)
        >>> si.render((8,), focus=True).cursor
        (2, 0)
        >>> si.render((2,), focus=True).cursor
        (0, 1)
        """
        c = self.__super.render(size, focus)
        if focus:
            # create a new canvas so we can add a cursor
            c = CompositeCanvas(c)
            c.cursor = self.get_cursor_coords(size)
        return c
开发者ID:eykd,项目名称:urwid,代码行数:24,代码来源:wimp.py

示例2: render

# 需要导入模块: from urwid.canvas import CompositeCanvas [as 别名]
# 或者: from urwid.canvas.CompositeCanvas import cursor [as 别名]
    def render(self, size, focus=False):
        """
        Render edit widget and return canvas.  Include cursor when in
        focus.

        >>> c = Edit("? ","yes").render((10,), focus=True)
        >>> c.text # ... = b in Python 3
        [...'? yes     ']
        >>> c.cursor
        (5, 0)
        """
        (maxcol,) = size
        self._shift_view_to_cursor = bool(focus)

        canv = Text.render(self,(maxcol,))
        if focus:
            canv = CompositeCanvas(canv)
            canv.cursor = self.get_cursor_coords((maxcol,))

        # .. will need to FIXME if I want highlight to work again
        #if self.highlight:
        #    hstart, hstop = self.highlight_coords()
        #    d.coords['highlight'] = [ hstart, hstop ]
        return canv
开发者ID:sporkexec,项目名称:urwid,代码行数:26,代码来源:widget.py


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