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


Python curses.KEY_F10屬性代碼示例

本文整理匯總了Python中curses.KEY_F10屬性的典型用法代碼示例。如果您正苦於以下問題:Python curses.KEY_F10屬性的具體用法?Python curses.KEY_F10怎麽用?Python curses.KEY_F10使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在curses的用法示例。


在下文中一共展示了curses.KEY_F10屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: modal

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import KEY_F10 [as 別名]
def modal(self):
        """run the modal getch-loop for this dialog"""
        if self.win:
            done = False
            while not done:
                key_pressed = self.win.getch()
                if key_pressed in [27, ord("q"), curses.KEY_F10]:
                    done = True
                if key_pressed == curses.KEY_DOWN:
                    self.down(1)
                if key_pressed == curses.KEY_UP:
                    self.down(-1)
                if key_pressed in [curses.KEY_IC, ord("=")]:
                    self.toggle_select()
                    self.down(1)

                for key, func in self.dlg_keys:
                    if key == key_pressed:
                        func()
                        done = True

        # help the garbage collector clean up circular references
        # to make sure __del__() will be called to close the dialog
        del self.dlg_keys 
開發者ID:caktux,項目名稱:pytrader,代碼行數:26,代碼來源:pytrader.py

示例2: validator

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import KEY_F10 [as 別名]
def validator(self, char):
        """here we tweak the behavior slightly, especially we want to
        end modal editing mode immediately on arrow up/down and on enter
        and we also want to catch ESC and F10, to abort the entire dialog"""
        if curses.ascii.isprint(char):
            return char
        if char == curses.ascii.TAB:
            char = curses.KEY_DOWN
        if char in [curses.KEY_DOWN, curses.KEY_UP]:
            self.result = char
            return curses.ascii.BEL
        if char in [10, 13, curses.KEY_ENTER, curses.ascii.BEL]:
            self.result = 10
            return curses.ascii.BEL
        if char == 127:
            char = curses.KEY_BACKSPACE
        if char in [27, curses.KEY_F10]:
            self.result = -1
            return curses.ascii.BEL
        return char 
開發者ID:caktux,項目名稱:pytrader,代碼行數:22,代碼來源:pytrader.py


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