本文整理汇总了Python中urwid.canvas.CompositeCanvas.trim方法的典型用法代码示例。如果您正苦于以下问题:Python CompositeCanvas.trim方法的具体用法?Python CompositeCanvas.trim怎么用?Python CompositeCanvas.trim使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类urwid.canvas.CompositeCanvas
的用法示例。
在下文中一共展示了CompositeCanvas.trim方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
# 需要导入模块: from urwid.canvas import CompositeCanvas [as 别名]
# 或者: from urwid.canvas.CompositeCanvas import trim [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