本文整理汇总了Python中curses.ACS_BLOCK属性的典型用法代码示例。如果您正苦于以下问题:Python curses.ACS_BLOCK属性的具体用法?Python curses.ACS_BLOCK怎么用?Python curses.ACS_BLOCK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类curses
的用法示例。
在下文中一共展示了curses.ACS_BLOCK属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write4bits
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_BLOCK [as 别名]
def write4bits(self, bits, char_mode=False):
self.stdscr.addch(self.cury, self.curx, curses.ACS_BLOCK if bits & 0x01 else ' ')
self.setCursor(self.cury+1, self.curx)
self.stdscr.addch(self.cury, self.curx, curses.ACS_BLOCK if bits & 0x02 else ' ')
self.setCursor(self.cury+1, self.curx)
self.stdscr.addch(self.cury, self.curx, curses.ACS_BLOCK if bits & 0x04 else ' ')
self.setCursor(self.cury+1, self.curx)
self.stdscr.addch(self.cury, self.curx, curses.ACS_BLOCK if bits & 0x08 else ' ')
self.setCursor(self.cury+1, self.curx)
self.stdscr.addch(self.cury, self.curx, curses.ACS_BLOCK if bits & 0x10 else ' ')
self.setCursor(self.cury+1, self.curx)
self.stdscr.addch(self.cury, self.curx, curses.ACS_BLOCK if bits & 0x20 else ' ')
self.setCursor(self.cury+1, self.curx)
self.stdscr.addch(self.cury, self.curx, curses.ACS_BLOCK if bits & 0x40 else ' ')
self.setCursor(self.cury+1, self.curx)
self.stdscr.addch(self.cury, self.curx, curses.ACS_BLOCK if bits & 0x80 else ' ')
self.setCursor(self.cury+1, self.curx)
示例2: hscrollbar
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_BLOCK [as 别名]
def hscrollbar(self, window, x, y, width, color):
window.addstr(y, x, "}", color)
window.addstr(y + height - 1, x, '}', color)
window.addch(y, int(x + 1 + progress * (width - 2)), curses.ACS_BLOCK, color)
示例3: update
# 需要导入模块: import curses [as 别名]
# 或者: from curses import ACS_BLOCK [as 别名]
def update(self, clear=True):
if clear: self.clear()
if self.hidden:
self.clear()
return False
length_of_display = self.width + 1
blocks_on_screen = length_of_display
if self.label:
label_str = self.translate_value()
if isinstance(label_str, bytes):
label_str = label_str.decode(self.encoding, 'replace')
blocks_on_screen -= len(label_str)+3
if self.do_colors():
label_attributes = self.parent.theme_manager.findPair(self)
else:
label_attributes = curses.A_NORMAL
self.add_line(
self.rely, self.relx+blocks_on_screen+2,
label_str,
self.make_attributes_list(label_str, label_attributes),
len(label_str)
)
# If want to handle neg. numbers, this line would need changing.
blocks_to_fill = (float(self.value) / float(self.out_of)) * int(blocks_on_screen)
if self.editing:
self.parent.curses_pad.attron(curses.A_BOLD)
#self.parent.curses_pad.bkgdset(curses.ACS_HLINE)
#self.parent.curses_pad.bkgdset(">")
#self.parent.curses_pad.bkgdset(curses.A_NORMAL)
BACKGROUND_CHAR = ">"
BARCHAR = curses.ACS_HLINE
else:
self.parent.curses_pad.attroff(curses.A_BOLD)
self.parent.curses_pad.bkgdset(curses.A_NORMAL)
#self.parent.curses_pad.bkgdset(curses.ACS_HLINE)
BACKGROUND_CHAR = curses.ACS_HLINE
BARCHAR = " "
for n in range(blocks_on_screen):
xoffset = self.relx
if self.do_colors():
self.parent.curses_pad.addch(self.rely,n+xoffset, BACKGROUND_CHAR, curses.A_NORMAL | self.parent.theme_manager.findPair(self))
else:
self.parent.curses_pad.addch(self.rely,n+xoffset, BACKGROUND_CHAR, curses.A_NORMAL)
for n in range(int(blocks_to_fill)):
if self.do_colors():
if self.block_color:
self.parent.curses_pad.addch(self.rely,n+xoffset, BARCHAR, self.parent.theme_manager.findPair(self, self.block_color))
else:
self.parent.curses_pad.addch(self.rely,n+xoffset, BARCHAR, curses.A_STANDOUT | self.parent.theme_manager.findPair(self))
else:
self.parent.curses_pad.addch(self.rely,n+xoffset, BARCHAR, curses.A_STANDOUT) #curses.ACS_BLOCK)
self.parent.curses_pad.attroff(curses.A_BOLD)
self.parent.curses_pad.bkgdset(curses.A_NORMAL)