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


Python curses.KEY_BTAB屬性代碼示例

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


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

示例1: set_up_handlers

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import KEY_BTAB [as 別名]
def set_up_handlers(self):
        """This function should be called somewhere during object initialisation (which all library-defined widgets do). You might like to override this in your own definition,
but in most cases the add_handers or add_complex_handlers methods are what you want."""
        #called in __init__
        self.handlers = {
                   curses.ascii.NL:     self.h_exit_down,
                   curses.ascii.CR:     self.h_exit_down,
                   curses.ascii.TAB:    self.h_exit_down,
                   curses.KEY_BTAB:     self.h_exit_up,
                   curses.KEY_DOWN:     self.h_exit_down,
                   curses.KEY_UP:       self.h_exit_up,
                   curses.KEY_LEFT:     self.h_exit_left,
                   curses.KEY_RIGHT:    self.h_exit_right,
                   # "^P":                self.h_exit_up,
                   # "^N":                self.h_exit_down,
                   curses.ascii.ESC:    self.h_exit_escape,
                   curses.KEY_MOUSE:    self.h_exit_mouse,
                   }

        self.complex_handlers = [] 
開發者ID:hexway,項目名稱:apple_bleee,代碼行數:22,代碼來源:wgwidget.py

示例2: set_up_handlers

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import KEY_BTAB [as 別名]
def set_up_handlers(self):
        """This function should be called somewhere during object initialisation (which all library-defined widgets do). You might like to override this in your own definition,
but in most cases the add_handers or add_complex_handlers methods are what you want."""
        #called in __init__
        self.handlers = {
                   curses.ascii.NL:     self.h_exit_down,
                   curses.ascii.CR:     self.h_exit_down,
                   curses.ascii.TAB:    self.h_exit_down,
                   curses.KEY_BTAB:     self.h_exit_up,
                   curses.KEY_DOWN:     self.h_exit_down,
                   curses.KEY_UP:       self.h_exit_up,
                   curses.KEY_LEFT:     self.h_exit_left,
                   curses.KEY_RIGHT:    self.h_exit_right,
                   "^P":                self.h_exit_up,
                   "^N":                self.h_exit_down,
                   curses.ascii.ESC:    self.h_exit_escape,
                   curses.KEY_MOUSE:    self.h_exit_mouse,
                   }

        self.complex_handlers = [] 
開發者ID:sealingtech,項目名稱:EDCOP,代碼行數:22,代碼來源:wgwidget.py

示例3: set_up_handlers

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import KEY_BTAB [as 別名]
def set_up_handlers(self):
        super(SimpleGrid, self).set_up_handlers()
        self.handlers = {
                    curses.KEY_UP:      self.h_move_line_up,
                    curses.KEY_LEFT:    self.h_move_cell_left,
                    curses.KEY_DOWN:    self.h_move_line_down,
                    curses.KEY_RIGHT:   self.h_move_cell_right,
                    "k":                self.h_move_line_up,
                    "h":                self.h_move_cell_left,
                    "j":                self.h_move_line_down,
                    "l":                self.h_move_cell_right,
                    curses.KEY_NPAGE:   self.h_move_page_down,
                    curses.KEY_PPAGE:   self.h_move_page_up,
                    curses.KEY_HOME:    self.h_show_beginning,
                    curses.KEY_END:     self.h_show_end,
                    ord('g'):           self.h_show_beginning,
                    ord('G'):           self.h_show_end,
                    curses.ascii.TAB:   self.h_exit,
                    curses.KEY_BTAB:     self.h_exit_up,
                    '^P':               self.h_exit_up,
                    '^N':               self.h_exit_down,
                    #curses.ascii.NL:    self.h_exit,
                    #curses.ascii.SP:    self.h_exit,
                    #ord('x'):       self.h_exit,
                    ord('q'):       self.h_exit,
                    curses.ascii.ESC:   self.h_exit,
                    curses.KEY_MOUSE:    self.h_exit_mouse,
                }

        self.complex_handlers = [
                    ] 
開發者ID:hexway,項目名稱:apple_bleee,代碼行數:33,代碼來源:wggrid.py

示例4: get_user_string

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import KEY_BTAB [as 別名]
def get_user_string(self, xpos=3, ypos=15, filterfunc=str.isalnum, completer=None):
        # filter allowed characters using filterfunc, alphanumeric by default
        user_string = ""
        user_input = 0
        if completer:
            completer = completer(self)
        while user_input != 10:
            user_input = self.screen.getch()
            if user_input == -1: # Input comes from pipe/file and is closed
                raise IOError
            self.screen_lock.acquire()
            # osx and unix backspace chars...
            if user_input == 127 or user_input == 263:
                if len(user_string) > 0:
                    user_string = user_string[:-1]
                    if completer:
                        completer.update_input(user_string)
                    self.screen.addstr(ypos, xpos, " " * (self.maxx-xpos-1))
            elif user_input in [ord('\t'), curses.KEY_BTAB] and completer:
                direction = 1 if user_input == ord('\t') else -1
                user_string = completer.complete(direction)
                self.screen.addstr(ypos, xpos, " " * (self.maxx-xpos-1))
            elif user_input < 256 and user_input != 10:
                if filterfunc(chr(user_input)) or chr(user_input) == '_':
                    user_string += chr(user_input)
                    if completer:
                        completer.update_input(user_string)
            self.screen.addstr(ypos, xpos, str(user_string))
            self.screen.refresh()
            self.screen_lock.release()
        return user_string 
開發者ID:jifunks,項目名稱:botany,代碼行數:33,代碼來源:menu_screen.py


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