def draw_rectangle(self, y, x, h, w, filled=True, dashed=False, color=None):
"""Rectangle with corners."""
if dashed:
hch = '-'
vch = '|'
else:
hch = curses.ACS_HLINE
vch = curses.ACS_VLINE
# Borders
self.draw_hline(y, x + 1, w - 2, hch, color) # top
self.draw_vline(y + 1, x + w - 1, h - 2, vch, color) # right
self.draw_hline(y + h - 1, x + 1, w - 2, hch, color) # bottom
self.draw_vline(y + 1, x, h - 2, vch, color) # left
# Corners
self.draw_ch(y, x, curses.ACS_ULCORNER, color)
self.draw_ch(y, x + w - 1, curses.ACS_URCORNER, color)
self.draw_ch(y + h - 1, x + w - 1, curses.ACS_LRCORNER, color)
self.draw_ch(y + h - 1, x, curses.ACS_LLCORNER, color)
# Fill
if filled:
self.draw_fill(y + 1, x + 1, h - 2, w - 2, color=color)
评论列表
文章目录