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


Python curses.A_DIM屬性代碼示例

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


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

示例1: highlight_until

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import A_DIM [as 別名]
def highlight_until(self, lines: Buf, idx: int) -> None:
        if self.start is None or self.end is None:
            return

        # XXX: this assumes pair 1 is the background
        attr = curses.A_REVERSE | curses.A_DIM | curses.color_pair(1)
        (s_y, s_x), (e_y, e_x) = self.get()
        if s_y == e_y:
            self.regions[s_y] = (HL(x=s_x, end=e_x, attr=attr),)
        else:
            self.regions[s_y] = (
                HL(x=s_x, end=len(lines[s_y]) + 1, attr=attr),
            )
            for l_y in range(s_y + 1, e_y):
                self.regions[l_y] = (
                    HL(x=0, end=len(lines[l_y]) + 1, attr=attr),
                )
            self.regions[e_y] = (HL(x=0, end=e_x, attr=attr),) 
開發者ID:asottile,項目名稱:babi,代碼行數:20,代碼來源:selection.py

示例2: set_titlebar

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import A_DIM [as 別名]
def set_titlebar(self):
		track_info = self.player.track.track_info(self.width - 1)
		# track_info -> ['title', 'artist', 'album'] - all algined
		self.stdscr.addstr(0, 1, track_info[0], curses.A_REVERSE)
		self.stdscr.addstr(1, 1, track_info[1], 
					curses.A_REVERSE | curses.A_BOLD | curses.A_DIM)
		self.stdscr.addstr(2, 1, track_info[2], curses.A_REVERSE) 
開發者ID:Jugran,項目名稱:lyrics-in-terminal,代碼行數:9,代碼來源:window.py

示例3: set_colors

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import A_DIM [as 別名]
def set_colors(self):
        """Sets up curses color pairs."""
        hicolor = os.getenv("TERM").endswith("256color")

        if self.monochrome:
            color = self.config.monochromecolors
        elif hicolor:
            color = self.config.xterm256colors
        else:
            color = self.config.xtermcolors

        bg = color.background
        curses.init_pair(Screen.COLOR_AUTHOR, *color.author)
        curses.init_pair(Screen.COLOR_BACKGROUND, bg, bg)
        curses.init_pair(Screen.COLOR_CORRECT, *color.correct)
        curses.init_pair(Screen.COLOR_HISCORE, *color.score)
        curses.init_pair(Screen.COLOR_INCORRECT, *color.incorrect)
        curses.init_pair(Screen.COLOR_PROMPT, *color.prompt)
        curses.init_pair(Screen.COLOR_QUOTE, *color.quote)
        curses.init_pair(Screen.COLOR_STATUS, *color.top_bar)

        # Rebind class variables
        Screen.COLOR_AUTHOR = curses.color_pair(Screen.COLOR_AUTHOR)
        Screen.COLOR_BACKGROUND = curses.color_pair(Screen.COLOR_BACKGROUND)
        Screen.COLOR_CORRECT = curses.color_pair(Screen.COLOR_CORRECT)
        Screen.COLOR_HISCORE = curses.color_pair(Screen.COLOR_HISCORE)
        Screen.COLOR_INCORRECT = curses.color_pair(Screen.COLOR_INCORRECT)
        Screen.COLOR_PROMPT = curses.color_pair(Screen.COLOR_PROMPT)
        Screen.COLOR_QUOTE = curses.color_pair(Screen.COLOR_QUOTE)
        Screen.COLOR_STATUS = curses.color_pair(Screen.COLOR_STATUS)

        if not hicolor:
            # Make certain colors more visible
            Screen.COLOR_CORRECT |= curses.A_DIM
            Screen.COLOR_INCORRECT |= curses.A_UNDERLINE | curses.A_BOLD
            Screen.COLOR_QUOTE |= curses.A_BOLD
            Screen.COLOR_STATUS |= curses.A_BOLD 
開發者ID:cslarsen,項目名稱:wpm,代碼行數:39,代碼來源:screen.py

示例4: region

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import A_DIM [as 別名]
def region(self, y: int, x: int, end: int) -> Generator[None, None, None]:
        # XXX: this assumes pair 1 is the background
        attr = curses.A_REVERSE | curses.A_DIM | curses.color_pair(1)
        self.regions[y] = (HL(x=x, end=end, attr=attr),)
        try:
            yield
        finally:
            del self.regions[y] 
開發者ID:asottile,項目名稱:babi,代碼行數:10,代碼來源:replace.py

示例5: draw_default

# 需要導入模塊: import curses [as 別名]
# 或者: from curses import A_DIM [as 別名]
def draw_default(self):
        # draws default menu
        clear_bar = " " * (int(self.maxx*2/3))
        self.screen_lock.acquire()
        self.screen.addstr(1, 2, self.title, curses.A_STANDOUT) # Title for this menu
        self.screen.addstr(3, 2, self.subtitle, curses.A_BOLD) #Subtitle for this menu
        # clear menu on screen
        for index in range(len(self.options)+1):
            self.screen.addstr(4+index, 4, clear_bar, curses.A_NORMAL)
        # display all the menu items, showing the 'pos' item highlighted
        for index in range(len(self.options)):
            textstyle = self.normal
            if index == self.selected:
                textstyle = self.highlighted
            self.screen.addstr(4+index ,4, clear_bar, curses.A_NORMAL)
            self.screen.addstr(4+index ,4, "%d - %s" % (index+1, self.options[index]), textstyle)

        self.screen.addstr(12, 2, clear_bar, curses.A_NORMAL)
        self.screen.addstr(13, 2, clear_bar, curses.A_NORMAL)
        self.screen.addstr(12, 2, "plant: ", curses.A_DIM)
        self.screen.addstr(12, 9, self.plant_string, curses.A_NORMAL)
        self.screen.addstr(13, 2, "score: ", curses.A_DIM)
        self.screen.addstr(13, 9, self.plant_ticks, curses.A_NORMAL)

        # display fancy water gauge
        if not self.plant.dead:
            water_gauge_str = self.water_gauge()
            self.screen.addstr(4,14, water_gauge_str, curses.A_NORMAL)
        else:
            self.screen.addstr(4,13, clear_bar, curses.A_NORMAL)
            self.screen.addstr(4,14, "(   RIP   )", curses.A_NORMAL)

        # draw cute ascii from files
        if self.visited_plant:
            # Needed to prevent drawing over a visited plant
            self.draw_plant_ascii(self.visited_plant)
        else:
            self.draw_plant_ascii(self.plant)
        self.screen_lock.release() 
開發者ID:jifunks,項目名稱:botany,代碼行數:41,代碼來源:menu_screen.py


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