當前位置: 首頁>>代碼示例>>Python>>正文


Python curses.is_term_resized方法代碼示例

本文整理匯總了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) 
開發者ID:OpenTrading,項目名稱:OpenTrader,代碼行數:10,代碼來源:tabview.py

示例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 
開發者ID:eerimoq,項目名稱:cantools,代碼行數:17,代碼來源:monitor.py

示例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() 
開發者ID:robertmuth,項目名稱:PyZwaver,代碼行數:45,代碼來源:example_simple.py


注:本文中的curses.is_term_resized方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。