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


Python curses.start_color方法代码示例

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


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

示例1: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [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

示例2: init_curses

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [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

示例3: wrapper_fork

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [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

示例4: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [as 别名]
def __init__(self):
        #curses.use_default_colors()
        self.define_colour_numbers()
        self._defined_pairs = {}
        self._names         = {}
        try:
            self._max_pairs = curses.COLOR_PAIRS - 1
            do_color = True
        except AttributeError:
            # curses.start_color has failed or has not been called
            do_color = False
            # Disable all color use across the application
            disableColor()
        if do_color and curses.has_colors():
            self.initialize_pairs()
            self.initialize_names() 
开发者ID:hexway,项目名称:apple_bleee,代码行数:18,代码来源:npysThemeManagers.py

示例5: init_curses

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [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

示例6: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [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

示例7: _init_curses

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [as 别名]
def _init_curses(self):
        self.stdscr = curses.initscr()
        self.stdscr.keypad(1)
        curses.noecho()
        curses.cbreak()
        curses.curs_set(0)
        curses.start_color()
        try:
            curses.init_pair(1, curses.COLOR_BLACK, 197)  # 接近机核主题的颜色
        except:
            # 树莓派 windows无法使用机核like色
            curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_RED)
        curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_BLACK)
        self.stdscr.bkgd(curses.color_pair(2))
        self.stdscr.timeout(100)
        self.stdscr.refresh() 
开发者ID:yihong0618,项目名称:gaycore,代码行数:18,代码来源:gcore_box.py

示例8: setup

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [as 别名]
def setup(self):
        curses.start_color()
        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)

        curses.cbreak()
        curses.echo()

        lines, cols = self.stdscr.getmaxyx()
        self.logwin = self.stdscr.subwin(lines - 2, cols, 0, 0)
        self.sepwin = self.stdscr.subwin(1, cols, lines - 2, 0)
        self.cmdwin = self.stdscr.subwin(1, cols, lines - 1, 0)

        self.logwin.scrollok(True)

        self.sepwin.bkgd(curses.color_pair(1))
        self.sepwin.refresh() 
开发者ID:flux3dp,项目名称:fluxclient,代码行数:18,代码来源:console.py

示例9: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [as 别名]
def __init__(self, hosts):
        self.stdscr = curses.initscr()
        curses.start_color()
        self.height, self.width = self.stdscr.getmaxyx()
        curses.cbreak()
        curses.noecho()
        self.stdscr.keypad(1)
        self.hosts = hosts
        self.format = (
            '%(hostname)10.10s '
            '%(pid)7.7s '
            '%(ppid)7.7s '
            '%(pcpu)6.6s '
            '%(rss)5.5s '
            '%(command)20s'
        ) 
开发者ID:dw,项目名称:mitogen,代码行数:18,代码来源:mitop.py

示例10: setup_curses

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [as 别名]
def setup_curses():
    """Setup terminal/curses state."""

    window = curses.initscr()
    curses.noecho()

    window = curses.newwin(
        WINDOW_HEIGHT + (VERT_PADDING * 2),
        WINDOW_WIDTH + (HORIZ_PADDING * 2),
        WINDOW_TOP - VERT_PADDING,
        WINDOW_LEFT - HORIZ_PADDING,
    )
    curses.start_color()

    global _COLOR_PAIRS
    _COLOR_PAIRS = {}
    for i, (k, v) in enumerate(COLOR_MAP.items(), 1):
        curses.init_pair(i, v, curses.COLOR_BLACK)
        _COLOR_PAIRS[k] = curses.color_pair(i)
    return window 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:22,代码来源:space_invaders.py

示例11: _initialize_colors

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [as 别名]
def _initialize_colors(self):
        """Function for initialzing curses colors. Called when CUI is first created.
        """

        # Start colors in curses
        curses.start_color()
        curses.init_pair(WHITE_ON_BLACK,    curses.COLOR_WHITE,     curses.COLOR_BLACK)
        curses.init_pair(BLACK_ON_GREEN,    curses.COLOR_BLACK,     curses.COLOR_GREEN)
        curses.init_pair(BLACK_ON_WHITE,    curses.COLOR_BLACK,     curses.COLOR_WHITE)
        curses.init_pair(WHITE_ON_RED,      curses.COLOR_WHITE,     curses.COLOR_RED)
        curses.init_pair(YELLOW_ON_BLACK,   curses.COLOR_YELLOW,    curses.COLOR_BLACK)
        curses.init_pair(RED_ON_BLACK,      curses.COLOR_RED,       curses.COLOR_BLACK)
        curses.init_pair(CYAN_ON_BLACK,     curses.COLOR_CYAN,      curses.COLOR_BLACK)
        curses.init_pair(MAGENTA_ON_BLACK,  curses.COLOR_MAGENTA,   curses.COLOR_BLACK)
        curses.init_pair(GREEN_ON_BLACK,    curses.COLOR_GREEN,     curses.COLOR_BLACK)
        curses.init_pair(BLUE_ON_BLACK,     curses.COLOR_BLUE,      curses.COLOR_BLACK) 
开发者ID:jwlodek,项目名称:py_cui,代码行数:18,代码来源:__init__.py

示例12: _init_screen

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [as 别名]
def _init_screen() -> 'curses._CursesWindow':
    # set the escape delay so curses does not pause waiting for sequences
    if sys.version_info >= (3, 9):  # pragma: no cover
        curses.set_escdelay(25)
    else:  # pragma: no cover
        os.environ.setdefault('ESCDELAY', '25')

    stdscr = curses.initscr()
    curses.noecho()
    curses.cbreak()
    # <enter> is not transformed into '\n' so it can be differentiated from ^J
    curses.nonl()
    # ^S / ^Q / ^Z / ^\ are passed through
    curses.raw()
    stdscr.keypad(True)

    with contextlib.suppress(curses.error):
        curses.start_color()
        curses.use_default_colors()
    return stdscr 
开发者ID:asottile,项目名称:babi,代码行数:22,代码来源:screen.py

示例13: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [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

示例14: start

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [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

示例15: setup

# 需要导入模块: import curses [as 别名]
# 或者: from curses import start_color [as 别名]
def setup(self, stdscr):
        fm_log(logger, 'init baidufm fm cli')
        self.stdscr = stdscr

        # init color
        curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK)
        curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_YELLOW, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(5, curses.COLOR_WHITE, curses.COLOR_BLACK)
        curses.init_pair(6, curses.COLOR_BLACK, curses.COLOR_MAGENTA)
        curses.init_pair(7, curses.COLOR_BLACK, curses.COLOR_GREEN)
        curses.init_pair(8, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
        curses.init_pair(9, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(10, curses.COLOR_RED, curses.COLOR_BLACK)

        curses.start_color()
        for i in range(0, curses.COLORS):
            if i < 10:
                continue
            curses.init_pair(i + 1, curses.COLOR_BLACK, i)

        self.player = choose_player()(self.footer, self.event)

        self.stdscr.nodelay(0)
        self.setup_and_draw_screen()
        self.run() 
开发者ID:tdoly,项目名称:baidufm-py,代码行数:29,代码来源:fm_cli.py


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