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


Python curses.COLOR_RED属性代码示例

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


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

示例1: __init__

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

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

示例4: main

# 需要导入模块: import curses [as 别名]
# 或者: from curses import COLOR_RED [as 别名]
def main():
    screen = init_curses()
    y, x = screen.getmaxyx()
    # create green
    curses.init_pair(1, curses.COLOR_GREEN, -1)
    # create red
    curses.init_pair(2, curses.COLOR_RED, -1) # -1 is default bcgd color
    # create white
    curses.init_pair(3, curses.COLOR_WHITE, -1)
    # create cyan
    curses.init_pair(4, curses.COLOR_CYAN, -1)
    # create yellow
    curses.init_pair(5, curses.COLOR_YELLOW, -1)
    # create black on white
    curses.init_pair(6, curses.COLOR_BLACK, curses.COLOR_WHITE)    
    # print the splash screen out!
    splash_screen(screen, y, x)
    

# check and see if this program is being run by itself
# if so call the main function 
开发者ID:JaredMHall,项目名称:RaspberryCloud,代码行数:23,代码来源:raspcloud.py

示例5: main

# 需要导入模块: import curses [as 别名]
# 或者: from curses import COLOR_RED [as 别名]
def main(stdscr, matches):
    curses.curs_set(False)
    selected = 0
    curses.init_pair(2, curses.COLOR_RED, curses.COLOR_BLACK)
    curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK)
    while True:
        printGames(stdscr, matches, selected)
        event = stdscr.getch()
        if event == ord("\n"):
            logging.info("Enter key pressed")
            return selected
        elif event == curses.KEY_UP:
            logging.info("Up key pressed")
            if selected != 0:
                selected -= 1
                printGames(stdscr,  matches,  selected)
        elif event == curses.KEY_DOWN:
            logging.info("Down key pressed")
            if selected != len(matches) - 1:
                selected += 1
                printGames(stdscr, matches,  selected) 
开发者ID:anubhavcodes,项目名称:scorer.py,代码行数:23,代码来源:ui.py

示例6: _init_curses

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

示例7: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import COLOR_RED [as 别名]
def __init__(self, use_colors):
		logging.Handler.__init__(self)
		self.use_colors = use_colors

		# Initialize environment
		curses.setupterm()

		# Get the foreground color attribute for this environment
		self.fcap = curses.tigetstr('setaf')

		#Get the normal attribute
		self.COLOR_NORMAL = curses.tigetstr('sgr0')

		# Get + Save the color sequences
		self.COLOR_INFO = curses.tparm(self.fcap, curses.COLOR_GREEN)
		self.COLOR_ERROR = curses.tparm(self.fcap, curses.COLOR_RED)
		self.COLOR_WARNING = curses.tparm(self.fcap, curses.COLOR_YELLOW)
		self.COLOR_DEBUG = curses.tparm(self.fcap, curses.COLOR_BLUE) 
开发者ID:imalisamar,项目名称:emailhunter-clone,代码行数:20,代码来源:ColorStreamHandler.py

示例8: setup

# 需要导入模块: import curses [as 别名]
# 或者: from curses import COLOR_RED [as 别名]
def setup(stdscr):
    # curses
    curses.use_default_colors()
    curses.init_pair(1, curses.COLOR_RED, -1)
    curses.init_pair(2, curses.COLOR_RED, curses.COLOR_RED)
    curses.init_pair(3, curses.COLOR_GREEN, -1)
    curses.init_pair(4, -1, curses.COLOR_RED)
    try:
        curses.curs_set(False)
    except curses.error:
        # fails on some terminals
        pass
    stdscr.timeout(0)

    # prepare input thread mechanisms
    curses_lock = Lock()
    input_queue = Queue()
    quit_event = Event()
    return (curses_lock, input_queue, quit_event) 
开发者ID:trehn,项目名称:termdown,代码行数:21,代码来源:termdown.py

示例9: _initialize_colors

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

示例10: show

# 需要导入模块: import curses [as 别名]
# 或者: from curses import COLOR_RED [as 别名]
def show(self, screen):
        self.screen = screen

        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
        self.white = curses.color_pair(1)

        curses.init_pair(2, curses.COLOR_GREEN, curses.COLOR_BLACK)
        self.green = curses.color_pair(2)

        curses.init_pair(3, curses.COLOR_YELLOW, curses.COLOR_BLACK)
        self.yellow = curses.color_pair(3)

        curses.init_pair(4, curses.COLOR_RED, curses.COLOR_BLACK)
        self.red = curses.color_pair(4)

        curses.curs_set(0)

        self.addstr(1, 1, 'BITNODES HARDWARE', self.white)
        self.addstr(1, 19, 'LOADING', self.yellow)

        while True:
            time.sleep(self.update()) 
开发者ID:ayeowch,项目名称:bitnodes-hardware,代码行数:24,代码来源:lcd.py

示例11: setup_palette

# 需要导入模块: import curses [as 别名]
# 或者: from curses import COLOR_RED [as 别名]
def setup_palette(class_):
        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
        curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK)
        curses.init_pair(5, curses.COLOR_RED, curses.COLOR_BLACK)
        curses.init_pair(6, curses.COLOR_CYAN, curses.COLOR_BLACK)
        curses.init_pair(7, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
        curses.init_pair(8, curses.COLOR_WHITE, curses.COLOR_BLUE)
        curses.init_pair(9, curses.COLOR_WHITE, curses.COLOR_RED)

        class_.WHITE = curses.color_pair(1)
        class_.BLUE = curses.color_pair(2)
        class_.GREEN = curses.color_pair(3)
        class_.YELLOW = curses.color_pair(4)
        class_.RED = curses.color_pair(5)
        class_.CYAN = curses.color_pair(6)
        class_.MAGENTA = curses.color_pair(7)
        class_.WHITE_ON_BLUE = curses.color_pair(8)
        class_.WHITE_ON_RED = curses.color_pair(9)

        class_.HASHTAG = class_.BLUE | curses.A_BOLD 
开发者ID:ihabunek,项目名称:toot,代码行数:24,代码来源:app.py

示例12: test_theme_from_file

# 需要导入模块: import curses [as 别名]
# 或者: from curses import COLOR_RED [as 别名]
def test_theme_from_file():

    with _ephemeral_directory() as dirname:
        with NamedTemporaryFile(mode='w+', dir=dirname) as fp:

            with pytest.raises(ConfigError):
                Theme.from_file(fp.name, 'installed')

            fp.write('[theme]\n')
            fp.write('Unknown = - -\n')
            fp.write('Upvote = - red\n')
            fp.write('Downvote = ansi_255 default bold\n')
            fp.write('NeutralVote = #000000 #ffffff bold+reverse\n')
            fp.flush()

            theme = Theme.from_file(fp.name, 'installed')
            assert theme.source == 'installed'
            assert 'Unknown' not in theme.elements
            assert theme.elements['Upvote'] == (
                -1, curses.COLOR_RED, curses.A_NORMAL)
            assert theme.elements['Downvote'] == (
                255, -1, curses.A_BOLD)
            assert theme.elements['NeutralVote'] == (
                16, 231, curses.A_BOLD | curses.A_REVERSE) 
开发者ID:michael-lazar,项目名称:rtv,代码行数:26,代码来源:test_theme.py

示例13: init_colors

# 需要导入模块: import curses [as 别名]
# 或者: from curses import COLOR_RED [as 别名]
def init_colors(self):

        if curses.has_colors() and curses.can_change_color():
            curses.init_color(self.COLOR_BLACK, 0, 0, 0)
            curses.init_color(self.COLOR_WHITE, 1000, 1000, 1000)
            curses.init_color(self.COLOR_BLUE, 0, 0, 1000)
            curses.init_color(self.COLOR_RED, 1000, 0, 0)
            curses.init_color(self.COLOR_GREEN, 0, 1000, 0)

            for i in xrange(0, self.GRAYS):
                curses.init_color(
                        self.GRAY_BASE + i,
                        i * 1000 / (self.GRAYS - 1),
                        i * 1000 / (self.GRAYS - 1),
                        i * 1000 / (self.GRAYS - 1)
                        )
                curses.init_pair(
                        self.GRAY_BASE + i,
                        self.GRAY_BASE + i,
                        self.COLOR_BLACK
                        )

        else:
            self.COLOR_BLACK = curses.COLOR_BLACK
            self.COLOR_WHITE = curses.COLOR_WHITE
            self.COLOR_BLUE = curses.COLOR_BLUE
            self.COLOR_RED = curses.COLOR_RED
            self.COLOR_GREEN = curses.COLOR_GREEN

            for i in xrange(0, self.GRAYS):
                curses.init_pair(
                        self.GRAY_BASE + i,
                        self.COLOR_WHITE,
                        self.COLOR_BLACK
                        )

        curses.init_pair(self.BLACK, self.COLOR_BLACK, self.COLOR_BLACK)
        curses.init_pair(self.WHITE, self.COLOR_WHITE, self.COLOR_BLACK)
        curses.init_pair(self.BLUE, self.COLOR_BLUE, self.COLOR_BLACK)
        curses.init_pair(self.RED, self.COLOR_RED, self.COLOR_BLACK)
        curses.init_pair(self.GREEN, self.COLOR_GREEN, self.COLOR_BLACK) 
开发者ID:Battelle,项目名称:sandsifter,代码行数:43,代码来源:gui.py

示例14: setup

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

示例15: run

# 需要导入模块: import curses [as 别名]
# 或者: from curses import COLOR_RED [as 别名]
def run(self):
        """
        """

        self.setup()

        # Clear screen
        self.screen.clear()
        #
        curses.start_color()

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

        while True:
            #
            session.expire_all()
            # TODO: Add some standard header to the top? (like interval time etc)
            #
            self.render()
            #
            self.increment.reset()
            #
            self.screen.refresh()
            #
            time.sleep(self.interval)

            self.running += self.interval

        return 
开发者ID:m3talstorm,项目名称:foe-bot,代码行数:36,代码来源:monitor.py


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