我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用curses.ACS_ULCORNER。
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)
def rectangle(win, uly, ulx, lry, lrx): """Draw a rectangle with corners at the provided upper-left and lower-right coordinates. """ win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1) win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1) win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1) win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1) win.addch(uly, ulx, curses.ACS_ULCORNER) win.addch(uly, lrx, curses.ACS_URCORNER) win.addch(lry, lrx, curses.ACS_LRCORNER) win.addch(lry, ulx, curses.ACS_LLCORNER)
def box(self, window, x, y, w, h, color): for i in xrange(1, w - 1): window.addch(y, x + i, curses.ACS_HLINE, color) window.addch(y + h - 1, x + i, curses.ACS_HLINE, color) for i in xrange(1, h - 1): window.addch(y + i, x, curses.ACS_VLINE, color) window.addch(y + i, x + w - 1, curses.ACS_VLINE, color) window.addch(y, x, curses.ACS_ULCORNER, color) window.addch(y, x + w - 1, curses.ACS_URCORNER, color) window.addch(y + h - 1, x, curses.ACS_LLCORNER, color) window.addch(y + h - 1, x + w - 1, curses.ACS_LRCORNER, color)
def bracket(self, window, x, y, h, color): for i in xrange(1, h - 1): window.addch(y + i, x, curses.ACS_VLINE, color) window.addch(y, x, curses.ACS_ULCORNER, color) window.addch(y + h - 1, x, curses.ACS_LLCORNER, color)
def rectangle(win, uly, ulx, lry, lrx): """ Draw a rectangle with corners at the provided upper-left and lower-right coordinates. Parameters: win (WindowObject): the screen/window uly (int): upper left y coordinate ulx (int): upper left x coordinate lry (int): lower right y coordinate lrx (int): lower right x coordinate Returns: None """ # Add exception handling try: win.vline(uly + 1, ulx, curses.ACS_VLINE, lry - uly - 1) win.hline(uly, ulx + 1, curses.ACS_HLINE, lrx - ulx - 1) win.hline(lry, ulx + 1, curses.ACS_HLINE, lrx - ulx - 1) win.vline(uly + 1, lrx, curses.ACS_VLINE, lry - uly - 1) win.addch(uly, ulx, curses.ACS_ULCORNER) win.addch(uly, lrx, curses.ACS_URCORNER) win.addch(lry, lrx, curses.ACS_LRCORNER) win.addch(lry, ulx, curses.ACS_LLCORNER) # Catch attempts to print a character out of the bounds of the window except curses.error: pass