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


Python curses.COLOR_MAGENTA屬性代碼示例

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


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

示例1: init_curses

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [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

示例2: _initialize_colors

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [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

示例3: setup_palette

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [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

示例4: setup

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [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

示例5: run

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [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

示例6: __init__

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [as 別名]
def __init__(self):
        """
        Setup the main screen, progress bars and logging box
        """
        self.screen = curses.initscr()
        curses.curs_set(0)

        curses.start_color()
        curses.init_pair(1, curses.COLOR_RED, 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_CYAN, curses.COLOR_BLACK)
        curses.init_pair(5, curses.COLOR_BLUE, curses.COLOR_BLACK)
        curses.init_pair(6, curses.COLOR_YELLOW, curses.COLOR_BLACK)

        self.height, self.width = self.screen.getmaxyx()
        self.screen.border()

        self.preptotal()
        self.prepcurrent()
        self.preplog()
        self.banner()
        self.sig()

        self.drives = len(glob.glob("/dev/sd?1"))
        self.donedrives = 0
        self.prevprogress = 0
        self.loglines = []
        self.idx = 1 
開發者ID:AonCyberLabs,項目名稱:EvilAbigail,代碼行數:31,代碼來源:evilmaid.py

示例7: setup_screen

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [as 別名]
def setup_screen(screen):
    """Sets up screen
    """
    # Set screen to getch() is non-blocking
    screen.nodelay(1)

    # Define some colors
    curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK)
    curses.init_pair(2, curses.COLOR_GREEN, curses.COLOR_BLACK)
    curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK)
    curses.init_pair(4, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
    curses.init_pair(5, curses.COLOR_YELLOW, curses.COLOR_BLACK)

    # Add border
    screen.border(0) 
開發者ID:madengr,項目名稱:ham2mon,代碼行數:17,代碼來源:cursesgui.py

示例8: __init__

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [as 別名]
def __init__(self, map_name='world', map_conf=None, window=None, encoding=None):
        if map_conf is None:
            map_conf = MAPS[map_name]
        self.map = map_conf['data']
        self.coords = map_conf['coords']
        self.corners = map_conf['corners']
        if window is None:
            window = curses.newwin(0, 0)
        self.window = window

        self.data = []
        self.data_timestamp = None

        # JSON contents _should_ be UTF8 (so, python internal unicode here...)
        if encoding is None:
            encoding = locale.getpreferredencoding()
        self.encoding = encoding

        # check if we can use transparent background or not
        if curses.can_change_color():
            curses.use_default_colors()
            background = -1
        else:
            background = curses.COLOR_BLACK

        tmp_colors = [
            ('red', curses.COLOR_RED, background),
            ('blue', curses.COLOR_BLUE, background),
            ('pink', curses.COLOR_MAGENTA, background)
        ]

        self.colors = {}
        if curses.has_colors():
            for i, (name, fgcolor, bgcolor) in enumerate(tmp_colors, 1):
                curses.init_pair(i, fgcolor, bgcolor)
                self.colors[name] = i 
開發者ID:sabri-zaki,項目名稱:EasY_HaCk,代碼行數:38,代碼來源:worldmap.py

示例9: define_colors

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [as 別名]
def define_colors(self):
        # TODO: implement colors
        # set curses color pairs manually
        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
        curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_BLACK)
        curses.init_pair(3, curses.COLOR_GREEN, curses.COLOR_BLACK)
        curses.init_pair(4, curses.COLOR_BLUE, curses.COLOR_BLACK)
        curses.init_pair(5, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
        curses.init_pair(6, curses.COLOR_YELLOW, curses.COLOR_BLACK)
        curses.init_pair(7, curses.COLOR_RED, curses.COLOR_BLACK)
        curses.init_pair(8, curses.COLOR_CYAN, curses.COLOR_BLACK) 
開發者ID:jifunks,項目名稱:botany,代碼行數:13,代碼來源:menu_screen.py

示例10: _screen_display_output

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [as 別名]
def _screen_display_output(self, output):
    """Actually render text output on the screen.

    Wraps the lines according to screen width. Pad lines below according to
    screen height so that the user can scroll the output to a state where
    the last non-empty line is on the top of the screen. Then renders the
    lines on the screen.

    Args:
      output: (RichTextLines) text lines to display on the screen. These lines
        may have widths exceeding the screen width. This method will take care
        of the wrapping.

    Returns:
      (List of int) A list of line indices, in the wrapped output, where there
        are regex matches.
    """

    # Wrap the output lines according to screen width.
    self._curr_wrapped_output, wrapped_line_indices = (
        debugger_cli_common.wrap_rich_text_lines(output, self._max_x - 2))

    # Append lines to curr_wrapped_output so that the user can scroll to a
    # state where the last text line is on the top of the output area.
    self._curr_wrapped_output.lines.extend([""] * (self._output_num_rows - 1))

    # Limit number of lines displayed to avoid curses overflow problems.
    if self._curr_wrapped_output.num_lines() > self.max_output_lines:
      self._curr_wrapped_output = self._curr_wrapped_output.slice(
          0, self.max_output_lines)
      self._curr_wrapped_output.lines.append("Output cut off at %d lines!" %
                                             self.max_output_lines)
      self._curr_wrapped_output.font_attr_segs[self.max_output_lines] = [
          (0, len(output.lines[-1]), cli_shared.COLOR_MAGENTA)
      ]

    self._display_nav_bar()
    self._display_main_menu(self._curr_wrapped_output)

    (self._output_pad, self._output_pad_height,
     self._output_pad_width) = self._display_lines(self._curr_wrapped_output,
                                                   self._output_num_rows)

    # The indices of lines with regex matches (if any) need to be mapped to
    # indices of wrapped lines.
    return [
        wrapped_line_indices[line]
        for line in self._unwrapped_regex_match_lines
    ] 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:51,代碼來源:curses_ui.py

示例11: _init_curses

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [as 別名]
def _init_curses(self):

        # Colors and attributes

        colors_empty = 1
        colors_obstacle = 2
        colors_bot1 = 3
        colors_bot2 = 4
        # Selected
        colors_empty_s = 5
        colors_obstacle_s = 6
        colors_bot1_s = 7
        colors_bot2_s = 8
        # Other
        colors_text = 9

        # (Color pair, Foreground, Background)
        cs.init_pair(colors_empty, cs.COLOR_WHITE, cs.COLOR_BLACK)
        cs.init_pair(colors_obstacle, cs.COLOR_BLACK, cs.COLOR_WHITE)
        cs.init_pair(colors_bot1, cs.COLOR_WHITE, cs.COLOR_RED)
        cs.init_pair(colors_bot2, cs.COLOR_WHITE, cs.COLOR_BLUE)
        cs.init_pair(colors_empty_s, cs.COLOR_WHITE, cs.COLOR_YELLOW)
        cs.init_pair(colors_obstacle_s, cs.COLOR_BLACK, cs.COLOR_YELLOW)
        cs.init_pair(colors_bot1_s, cs.COLOR_WHITE, cs.COLOR_MAGENTA)
        cs.init_pair(colors_bot2_s, cs.COLOR_WHITE, cs.COLOR_CYAN)
        cs.init_pair(colors_text, cs.COLOR_WHITE, cs.COLOR_BLACK)

        # Attributes
        attr_empty = cs.A_NORMAL
        attr_obstacle = cs.A_NORMAL
        attr_bot1 = cs.A_BOLD
        attr_bot2 = cs.A_BOLD
        attr_empty_s = cs.A_NORMAL
        attr_obstacle_s = cs.A_NORMAL
        attr_bot1_s = cs.A_BOLD
        attr_bot2_s = cs.A_BOLD
        attr_text = cs.A_NORMAL

        # **** Do not edit settings below this line ***

        cs.curs_set(0)
        self._attr_empty = cs.color_pair(colors_empty) | attr_empty
        self._attr_obstacle = cs.color_pair(colors_obstacle) | attr_obstacle
        self._attr_bot1 = cs.color_pair(colors_bot1) | attr_bot1
        self._attr_bot2 = cs.color_pair(colors_bot2) | attr_bot2
        self._attr_empty_s = cs.color_pair(colors_empty_s) | attr_empty_s
        self._attr_obstacle_s = cs.color_pair(colors_obstacle_s) \
            | attr_obstacle_s
        self._attr_bot1_s = cs.color_pair(colors_bot1_s) | attr_bot1_s
        self._attr_bot2_s = cs.color_pair(colors_bot2_s) | attr_bot2_s
        self._attr_text = cs.color_pair(colors_text) | attr_text 
開發者ID:RobotGame,項目名稱:rgkit,代碼行數:53,代碼來源:rgcurses.py

示例12: main

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import COLOR_MAGENTA [as 別名]
def main(self, stdscr):
        self.screen = stdscr

        curses.use_default_colors()

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

        COLOR_RED = curses.color_pair(1)
        COLOR_MAGENTA = curses.color_pair(2)
        COLOR_YELLOW = curses.color_pair(3)
        COLOR_BLUE = curses.color_pair(4)
        COLOR_CYAN = curses.color_pair(5)
        COLOR_GREEN = curses.color_pair(6)
        COLOR_BLACK = curses.color_pair(7)

        self.SEVERITY_MAP = {
            'security': ['Sec', COLOR_BLACK],
            'critical': ['Crit', COLOR_RED],
            'major': ['Majr', COLOR_MAGENTA],
            'minor': ['Minr', COLOR_YELLOW],
            'warning': ['Warn', COLOR_BLUE],
            'indeterminate': ['Ind ', COLOR_CYAN],
            'cleared': ['Clr', COLOR_GREEN],
            'normal': ['Norm', COLOR_GREEN],
            'ok': ['Ok', COLOR_GREEN],
            'informational': ['Info', COLOR_GREEN],
            'debug': ['Dbug', COLOR_BLACK],
            'trace': ['Trce', COLOR_BLACK],
            'unknown': ['Unkn', COLOR_BLACK]
        }

        self.screen.keypad(1)
        self.screen.nodelay(1)

        while True:
            self.update()
            event = self.screen.getch()
            if 0 < event < 256:
                self._key_press(chr(event))
            else:
                if event == curses.KEY_RESIZE:
                    self.update()
            time.sleep(2) 
開發者ID:alerta,項目名稱:python-alerta-client,代碼行數:51,代碼來源:top.py


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