我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用curses.ACS_VLINE。
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 setup_menu(self): """ Draw the main frame of `Setup` tab in the TUI window. """ screen = self._stdscr.subwin(21, 80, 2, 0) screen.box() screen.bkgd(' ', curses.color_pair(4)) # Configuration Section screen.addch(0, 26, curses.ACS_BSSS) screen.vline(1, 26, curses.ACS_VLINE, 17) # Status Section screen.addch(7, 0, curses.ACS_SSSB) screen.addch(7, 26, curses.ACS_SBSS) screen.hline(7, 1, curses.ACS_HLINE, 25) # Select Functions Section screen.addch(0, 52, curses.ACS_BSSS) screen.vline(1, 52, curses.ACS_VLINE, 17) # Process Bar Section screen.addch(18, 0, curses.ACS_SSSB) screen.addch(18, 79, curses.ACS_SBSS) screen.hline(18, 1, curses.ACS_HLINE, 78) screen.addch(18, 26, curses.ACS_SSBS) screen.addch(18, 52, curses.ACS_SSBS) # Section Titles title = curses.color_pair(6) subtitles = [["Configure Settings", (1, 2)], ["Status", (8, 2)], ["Hosts File", (13, 2)], ["Select Functions", (1, 28)]] for s_title in subtitles: cord = s_title[1] screen.addstr(cord[0], cord[1], s_title[0], title) screen.hline(cord[0] + 1, cord[1], curses.ACS_HLINE, 23) screen.refresh()
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
def draw_vline(self, y, x, h, ch=None, color=None): """Vertical line.""" ch = ch or curses.ACS_VLINE for dy in range(h): self.draw_ch(y + dy, x, ch, color)