drawable.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:sciibo 作者: fdev 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号