当前位置: 首页>>代码示例>>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;未经允许,请勿转载。