本文整理汇总了Python中curses.is_term_resized方法的典型用法代码示例。如果您正苦于以下问题:Python curses.is_term_resized方法的具体用法?Python curses.is_term_resized怎么用?Python curses.is_term_resized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curses
的用法示例。
在下文中一共展示了curses.is_term_resized方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resize
# 需要导入模块: import curses [as 别名]
# 或者: from curses import is_term_resized [as 别名]
def resize(self):
"""Handle terminal resizing"""
# Check if screen was re-sized (True or False)
resize = self.max_x == 0 or \
curses.is_term_resized(self.max_y, self.max_x)
if resize is True:
self.recalculate_layout()
curses.resizeterm(self.max_y, self.max_x)
示例2: update
# 需要导入模块: import curses [as 别名]
# 或者: from curses import is_term_resized [as 别名]
def update(self):
if self._playing:
modified = self.update_messages()
else:
modified = False
if self._modified:
self._modified = False
modified = True
if curses.is_term_resized(self._nrows, self._ncols):
self._nrows, self._ncols = self._stdscr.getmaxyx()
modified = True
return modified
示例3: Redraw
# 需要导入模块: import curses [as 别名]
# 或者: from curses import is_term_resized [as 别名]
def Redraw(self):
self.stdscr.clear()
if curses.is_term_resized(self.h, self.w):
self.h, self.w = self.stdscr.getmaxyx()
curses.resizeterm(self.h, self.w)
i = 0
i += self._titleyx(i, 0, "CONTROLLER")
lines = str(self.controller).split("\n")
i += self._printyx(i, 0, lines)
def render_node(n):
if n == self.controller.GetNodeId():
return"node %d CONTROLLER" % n
elif n in self.controller.failed_nodes:
return"node %d FAILED" % n
elif n in self.nodeset.nodes:
node = self.nodeset.nodes[n]
return "%s %s" % (node.Name(), node.state)
else:
return "Node %d UNKNOWN" % n
i += self._titleyx(i, 0, "NODES")
nodes = set(self.controller.nodes) | self.nodeset.nodes.keys()
lines = [render_node(n) for n in nodes]
i += self._printyx(i, 0, lines)
i += self._titleyx(i, 0, "QUEUE")
lines = self.driver.OutQueueString().split("\n")
i += self._printyx(i, 0, lines)
i += self._titleyx(i, 0, "STATS")
lines = MessageStatsString(self.driver.History()).split("\n")
i += self._printyx(i, 0, lines)
i = 1
lines = [self.format(r) for r in self.messages[-self.h + 2:]]
self._printyx(i, 81, lines)
i += len(lines) + 1
self.stdscr.refresh()