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


Python CompositeCanvas.pad_trim_top_bottom方法代码示例

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


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

示例1: render

# 需要导入模块: from urwid.canvas import CompositeCanvas [as 别名]
# 或者: from urwid.canvas.CompositeCanvas import pad_trim_top_bottom [as 别名]
    def render(self, size, focus=False):
        """
        Render GraphVScale.
        """
        (maxcol, maxrow) = size
        pl = scale_bar_values(self.pos, self.top, maxrow)

        combinelist = []
        rows = 0
        for p, t in zip(pl, self.txt):
            p -= 1
            if p >= maxrow:
                break
            if p < rows:
                continue
            c = t.render((maxcol,))
            if p > rows:
                run = p - rows
                c = CompositeCanvas(c)
                c.pad_trim_top_bottom(run, 0)
            rows += c.rows()
            combinelist.append((c, None, False))
        if not combinelist:
            return SolidCanvas(" ", size[0], size[1])

        c = CanvasCombine(combinelist)
        if maxrow - rows:
            c.pad_trim_top_bottom(0, maxrow - rows)
        return c
开发者ID:Julian,项目名称:urwid,代码行数:31,代码来源:graphics.py

示例2: render

# 需要导入模块: from urwid.canvas import CompositeCanvas [as 别名]
# 或者: from urwid.canvas.CompositeCanvas import pad_trim_top_bottom [as 别名]
    def render(self, size, focus=False):
        """Render top_w overlayed on bottom_w."""
        left, right, top, bottom = self.calculate_padding_filler(size, focus)
        bottom_c = self.bottom_w.render(size)
        top_c = self.top_w.render(self.top_w_size(size, left, right, top, bottom), focus)
        top_c = CompositeCanvas(top_c)
        if left < 0 or right < 0:
            top_c.pad_trim_left_right(min(0, left), min(0, right))
        if top < 0 or bottom < 0:
            top_c.pad_trim_top_bottom(min(0, top), min(0, bottom))

        return CanvasOverlay(top_c, bottom_c, left, top)
开发者ID:0xPr0xy,项目名称:blogger-cli,代码行数:14,代码来源:container.py

示例3: render

# 需要导入模块: from urwid.canvas import CompositeCanvas [as 别名]
# 或者: from urwid.canvas.CompositeCanvas import pad_trim_top_bottom [as 别名]
 def render(self, size, focus=False):
     """Render self.original_widget with space above and/or below."""
     (maxcol, maxrow) = size
     top, bottom = self.filler_values(size, focus)
     
     if self.height_type is None:
         canv = self._original_widget.render((maxcol,), focus)
     else:
         canv = self._original_widget.render((maxcol,maxrow-top-bottom),focus)
     canv = CompositeCanvas(canv)
     
     if maxrow and canv.rows() > maxrow and canv.cursor is not None:
         cx, cy = canv.cursor
         if cy >= maxrow:
             canv.trim(cy-maxrow+1,maxrow-top-bottom)
     if canv.rows() > maxrow:
         canv.trim(0, maxrow)
         return canv
     canv.pad_trim_top_bottom(top, bottom)
     return canv
开发者ID:0xPr0xy,项目名称:soundcloud-cli,代码行数:22,代码来源:decoration.py


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