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


Python curses.halfdelay方法代碼示例

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


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

示例1: run

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import halfdelay [as 別名]
def run(self, scr):
        """ Initialize and run the application """
        m = AsciiMap()
        curses.halfdelay(self.sleep)
        while True:
            now = int(time.time())
            refresh = self.fetch_data(now)
            m.set_data(self.data)
            m.draw(scr)
            scr.addstr(0, 1, 'Shodan Radar', curses.A_BOLD)
            scr.addstr(0, 40, time.strftime("%c UTC", time.gmtime(now)).rjust(37), curses.A_BOLD)

            # Key Input
            # q     - Quit
            event = scr.getch()
            if event == ord('q'):
                break

            # redraw window (to fix encoding/rendering bugs and to hide other messages to same tty)
            # user pressed 'r' or new data was fetched
            if refresh:
                m.window.redrawwin() 
開發者ID:sabri-zaki,項目名稱:EasY_HaCk,代碼行數:24,代碼來源:worldmap.py

示例2: conf_scr

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import halfdelay [as 別名]
def conf_scr():
    '''Configure the screen and colors/etc'''
    curses.curs_set(0)
    curses.start_color()
    curses.use_default_colors()
    text, banner, banner_text, background = get_theme_colors()
    curses.init_pair(2, text, background)
    curses.init_pair(3, banner_text, banner)
    curses.halfdelay(10) 
開發者ID:huwwp,項目名稱:cryptop,代碼行數:11,代碼來源:cryptop.py

示例3: get_string

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import halfdelay [as 別名]
def get_string(stdscr, prompt):
    '''Requests and string from the user'''
    curses.echo()
    stdscr.clear()
    stdscr.addnstr(0, 0, prompt, -1, curses.color_pair(2))
    curses.curs_set(1)
    stdscr.refresh()
    in_str = stdscr.getstr(1, 0, 20).decode()
    curses.noecho()
    curses.curs_set(0)
    stdscr.clear()
    curses.halfdelay(10)
    return in_str 
開發者ID:huwwp,項目名稱:cryptop,代碼行數:15,代碼來源:cryptop.py

示例4: init

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import halfdelay [as 別名]
def init():
    # Don't display user input
    curses.noecho()
    # React to keys without pressing enter (700ms delay)
    curses.halfdelay(7)
    # Enumerate keys
    stdscr.keypad(True)

    #return stdscr 
開發者ID:jaybutera,項目名稱:tetrisRL,代碼行數:11,代碼來源:user_engine.py

示例5: start

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import halfdelay [as 別名]
def start(self):
        """
        Initialize the screen and input mode.
        """
        assert self._started == False

        self.s = curses.initscr()
        self.has_color = curses.has_colors()
        if self.has_color:
            curses.start_color()
            if curses.COLORS < 8:
                # not colourful enough
                self.has_color = False
        if self.has_color:
            try:
                curses.use_default_colors()
                self.has_default_colors=True
            except _curses.error:
                self.has_default_colors=False
        self._setup_colour_pairs()
        curses.noecho()
        curses.meta(1)
        curses.halfdelay(10) # use set_input_timeouts to adjust
        self.s.keypad(0)
        
        if not self._signal_keys_set:
            self._old_signal_keys = self.tty_signal_keys()

        super(Screen, self).start() 
開發者ID:AnyMesh,項目名稱:anyMesh-Python,代碼行數:31,代碼來源:curses_display.py

示例6: _getch

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import halfdelay [as 別名]
def _getch(self, wait_tenths):
        if wait_tenths==0:
            return self._getch_nodelay()
        if wait_tenths is None:
            curses.cbreak()
        else:
            curses.halfdelay(wait_tenths)
        self.s.nodelay(0)
        return self.s.getch() 
開發者ID:AnyMesh,項目名稱:anyMesh-Python,代碼行數:11,代碼來源:curses_display.py

示例7: _dbg_instr

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import halfdelay [as 別名]
def _dbg_instr(self): # messy input string (intended for debugging)
        curses.echo()
        self.s.nodelay(0)
        curses.halfdelay(100)
        str = self.s.getstr()
        curses.noecho()
        return str 
開發者ID:AnyMesh,項目名稱:anyMesh-Python,代碼行數:9,代碼來源:curses_display.py

示例8: __init__

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import halfdelay [as 別名]
def __init__(self, api):
        self.api = api
        self.data = None
        self.last_fetch = 0
        self.sleep = 10  # tenths of seconds, for curses.halfdelay()
        self.polling_interval = 60 
開發者ID:sabri-zaki,項目名稱:EasY_HaCk,代碼行數:8,代碼來源:worldmap.py

示例9: get_and_use_key_press

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import halfdelay [as 別名]
def get_and_use_key_press(self):
        global TEST_SETTINGS
        if (TEST_SETTINGS['TEST_INPUT'] is None) and (TEST_SETTINGS['INPUT_GENERATOR'] is None):
            curses.raw()
            curses.cbreak()
            curses.meta(1)
            self.parent.curses_pad.keypad(1)
            if self.parent.keypress_timeout:
                curses.halfdelay(self.parent.keypress_timeout)
                ch = self._get_ch()
                if ch == -1:
                    return self.try_while_waiting()
            else:
                self.parent.curses_pad.timeout(-1)
                ch = self._get_ch()
            # handle escape-prefixed rubbish.
            if ch == curses.ascii.ESC:
                #self.parent.curses_pad.timeout(1)
                self.parent.curses_pad.nodelay(1)
                ch2 = self.parent.curses_pad.getch()
                if ch2 != -1: 
                    ch = curses.ascii.alt(ch2)
                self.parent.curses_pad.timeout(-1) # back to blocking mode
                #curses.flushinp()
        elif (TEST_SETTINGS['INPUT_GENERATOR']):
            self._last_get_ch_was_unicode = True
            try:
                ch = next(TEST_SETTINGS['INPUT_GENERATOR'])
            except StopIteration:
                if TEST_SETTINGS['CONTINUE_AFTER_TEST_INPUT']:
                    TEST_SETTINGS['INPUT_GENERATOR'] = None
                    return
                else:
                    raise ExhaustedTestInput
        else:
            self._last_get_ch_was_unicode = True
            try:
                ch = TEST_SETTINGS['TEST_INPUT'].pop(0)
                TEST_SETTINGS['TEST_INPUT_LOG'].append(ch)
            except IndexError:
                if TEST_SETTINGS['CONTINUE_AFTER_TEST_INPUT']:
                    TEST_SETTINGS['TEST_INPUT'] = None
                    return
                else:
                    raise ExhaustedTestInput
        
        self.handle_input(ch)
        if self.check_value_change:
            self.when_check_value_changed()
        if self.check_cursor_move:
            self.when_check_cursor_moved()
        
        
        self.try_adjust_widgets() 
開發者ID:hexway,項目名稱:apple_bleee,代碼行數:56,代碼來源:wgwidget.py


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