本文整理汇总了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),)
示例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)
示例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
示例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]
示例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()