Python curses.is_term_resized() Examples
The following are 3
code examples of curses.is_term_resized().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
curses
, or try the search function
.
Example #1
Source File: monitor.py From cantools with MIT License | 5 votes |
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
Example #2
Source File: tabview.py From OpenTrader with GNU Lesser General Public License v3.0 | 4 votes |
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)
Example #3
Source File: example_simple.py From PyZwaver with GNU General Public License v3.0 | 4 votes |
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()