当前位置: 首页>>代码示例>>Python>>正文


Python curses.initscr方法代码示例

本文整理汇总了Python中curses.initscr方法的典型用法代码示例。如果您正苦于以下问题:Python curses.initscr方法的具体用法?Python curses.initscr怎么用?Python curses.initscr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在curses的用法示例。


在下文中一共展示了curses.initscr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initscr

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def initscr():
    import _curses, curses
    # we call setupterm() here because it raises an error
    # instead of calling exit() in error cases.
    setupterm(term=_os.environ.get("TERM", "unknown"),
              fd=_sys.__stdout__.fileno())
    stdscr = _curses.initscr()
    for key, value in _curses.__dict__.items():
        if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'):
            setattr(curses, key, value)

    return stdscr

# This is a similar wrapper for start_color(), which adds the COLORS and
# COLOR_PAIRS variables which are only available after start_color() is
# called. 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:18,代码来源:__init__.py

示例2: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def __init__(self, enable=True):
        self.enable = enable
        if not self.enable:
            return
        self.logger = logging.getLogger('trader-logger')
        self.stdscr = curses.initscr()
        self.pad = curses.newpad(23, 120)
        self.order_pad = curses.newpad(10, 120)
        self.timestamp = ""
        self.last_order_update = 0
        curses.start_color()
        curses.noecho()
        curses.cbreak()
        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_GREEN)
        curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_RED)
        self.stdscr.keypad(1)
        self.pad.addstr(1, 0, "Waiting for a trade...") 
开发者ID:mcardillo55,项目名称:cbpro-trader,代码行数:19,代码来源:cursesDisplay.py

示例3: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def __init__(self, rows=16, cols=100 ):

		self.FONTS_SUPPORTED = False

		self.rows = rows
		self.cols = cols

		self.stdscr = curses.initscr()
		self.curx = 0
		self.cury = 0

		if (curses.LINES < rows+1) or (curses.COLS < cols+1):
			raise RuntimeError(u"Screen too small.  Increase size to at least ({0}, {1})".format(rows+1, cols+1))

		# Set up parent class.  Note.  This must occur after display has been
		# initialized as the parent class may attempt to load custom fonts
		super(lcd_curses, self).__init__(rows,cols,1)

		locale.setlocale(locale.LC_ALL, '') 
开发者ID:dhrone,项目名称:pydPiper,代码行数:21,代码来源:lcd_curses.py

示例4: init_curses

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def init_curses():
    window = curses.initscr()
    curses.noecho() # prevents user input from being echoed
    curses.curs_set(0) # make cursor invisible

    curses.start_color()
    curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK)
    curses.init_pair(2, curses.COLOR_CYAN, curses.COLOR_BLACK)
    curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK)
    curses.init_pair(4, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
    curses.init_pair(5, curses.COLOR_YELLOW, curses.COLOR_BLACK)

    window.timeout(50)
    window.keypad(1) # interpret arrow keys, etc

    return window 
开发者ID:esotericnonsense,项目名称:bitcoind-ncurses,代码行数:18,代码来源:interface.py

示例5: wrapper_basic

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def wrapper_basic(call_function):
    #set the locale properly
    locale.setlocale(locale.LC_ALL, '')
    return curses.wrapper(call_function)

#def wrapper(call_function):
#   locale.setlocale(locale.LC_ALL, '')
#   screen = curses.initscr()
#   curses.noecho()
#   curses.cbreak()
#   
#   return_code = call_function(screen)
#   
#   curses.nocbreak()
#   curses.echo()
#   curses.endwin() 
开发者ID:hexway,项目名称:apple_bleee,代码行数:18,代码来源:npyssafewrapper.py

示例6: wrapper_fork

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def wrapper_fork(call_function, reset=True):
    pid = os.fork()
    if pid:
        # Parent
        os.waitpid(pid, 0)
        if reset:
            external_reset()
    else:
        locale.setlocale(locale.LC_ALL, '')
        _SCREEN = curses.initscr()
        try:
            curses.start_color()
        except:
            pass
        _SCREEN.keypad(1)
        curses.noecho()
        curses.cbreak()
        curses.def_prog_mode()
        curses.reset_prog_mode()
        return_code = call_function(_SCREEN)
        _SCREEN.keypad(0)
        curses.echo()
        curses.nocbreak()
        curses.endwin()
        sys.exit(0) 
开发者ID:hexway,项目名称:apple_bleee,代码行数:27,代码来源:npyssafewrapper.py

示例7: init_curses

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def init_curses(self):
        """Setup the curses"""
        self.window = curses.initscr()
        self.height, self.width = self.window.getmaxyx()
        if self.width < 60:
            self.too_small = True
            return

        self.window.keypad(True)
        # self.window.nodelay(True)

        curses.noecho()
        curses.curs_set(False)
        curses.cbreak()
        curses.start_color()
        curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK)
        curses.init_pair(2, curses.COLOR_YELLOW, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_WHITE, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(5, curses.COLOR_WHITE, curses.COLOR_CYAN) 
开发者ID:Macr0phag3,项目名称:email_hack,代码行数:22,代码来源:CLI.py

示例8: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def __init__(self, scanner):
		self.scanner = scanner
		self.screen = curses.initscr()
		curses.noecho()
		curses.cbreak()
		self.screen.keypad(1)
		self.screen.scrollok(True)
		self.x, self.y = self.screen.getmaxyx()
		curses.start_color()
		curses.use_default_colors()
		try:
			self.screen.curs_set(0)
		except:
			try:
				self.screen.curs_set(1)
			except:
				pass 
开发者ID:hash3liZer,项目名称:airpydump,代码行数:19,代码来源:airpydump.py

示例9: setup_reporter

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def setup_reporter(processor, arguments):
    if arguments['--no-follow']:
        return

    scr = curses.initscr()
    atexit.register(curses.endwin)

    def print_report(sig, frame):
        output = processor.report()
        scr.erase()
        try:
            scr.addstr(output)
        except curses.error:
            pass
        scr.refresh()

    signal.signal(signal.SIGALRM, print_report)
    interval = float(arguments['--interval'])
    signal.setitimer(signal.ITIMER_REAL, 0.1, interval) 
开发者ID:lebinh,项目名称:ngxtop,代码行数:21,代码来源:ngxtop.py

示例10: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def __init__(self, ts, injector, tests, do_tick, disassembler=disas_capstone):
        self.ts = ts;
        self.injector = injector
        self.T = tests
        self.gui_thread = None
        self.do_tick = do_tick
        self.ticks = 0

        self.last_ins_count = 0
        self.delta_log = deque(maxlen=self.RATE_Q)
        self.time_log = deque(maxlen=self.RATE_Q)

        self.disas = disassembler

        self.stdscr = curses.initscr()
        curses.start_color()

        # doesn't work
        # self.orig_colors = [curses.color_content(x) for x in xrange(256)]

        curses.use_default_colors()
        curses.noecho()
        curses.cbreak()
        curses.curs_set(0)
        self.stdscr.nodelay(1)

        self.sx = 0
        self.sy = 0

        self.init_colors()

        self.stdscr.bkgd(curses.color_pair(self.WHITE))

        self.last_time = time.time() 
开发者ID:Battelle,项目名称:sandsifter,代码行数:36,代码来源:sifter.py

示例11: start

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def start(self, no_delay):
        self.window = curses.initscr()
        curses.start_color()
        curses.use_default_colors()
        curses.noecho()
        curses.cbreak()
        curses.curs_set(0)
        self.window.nodelay(no_delay)
        self.init_colors()
        self.window.bkgd(curses.color_pair(self.WHITE))
        locale.setlocale(locale.LC_ALL, '')    # set your locale
        self.code = locale.getpreferredencoding() 
开发者ID:Battelle,项目名称:sandsifter,代码行数:14,代码来源:gui.py

示例12: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def __init__(self, keybinds):
		self.keybinds = keybinds
		self.options = Config('OPTIONS')

		self.win = curses.initscr()
		self.win.box()
		self.add_text()
		self.main() 
开发者ID:Jugran,项目名称:lyrics-in-terminal,代码行数:10,代码来源:window.py

示例13: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def __init__(self, developer_key, custom_search_cx,
                 progressbar_fn=None, progress=False, validate_images=True):

        # initialise google api
        self._google_custom_search = GoogleCustomSearch(
            developer_key, custom_search_cx, self)

        self._search_result = []
        self.validate_images = validate_images

        self._stdscr = None
        self._progress = False
        self._chunk_sizes = {}
        self._terminal_lines = {}
        self._search_again = False
        self._download_progress = {}
        self._report_progress = progressbar_fn

        self._set_data()

        self._page = 1
        self._number_of_images = 1

        if progressbar_fn:
            # user nserted progressbar fn
            self._progress = True
        else:
            if progress:
                # initialise internal progressbar
                self._progress = True
                self._stdscr = curses.initscr()
                self._report_progress = self.__report_progress 
开发者ID:arrrlo,项目名称:Google-Images-Search,代码行数:34,代码来源:fetch_resize_save.py

示例14: initCurses

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def initCurses():
    screen = curses.initscr()
    curses.noecho()  # disable the keypress echo to prevent double input
    curses.cbreak()  # disable line buffers to run the keypress immediately
    curses.curs_set(0)
    screen.keypad(1)  # enable keyboard use

    screen.addstr(1, 2, "Fuzzing For Worms", curses.A_UNDERLINE)
    return screen 
开发者ID:dobin,项目名称:ffw,代码行数:11,代码来源:gui.py

示例15: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import initscr [as 别名]
def __init__(self):
        self.message = {}
        self.queue = multi.Queue()
        self.stdscr = curses.initscr()
        curses.noecho()

        for i in range(NTHREADS):
            self.message[i] = "..."
        self.message[-1] = "..." 
开发者ID:rantonels,项目名称:starless,代码行数:11,代码来源:tracer.py


注:本文中的curses.initscr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。