python类newwin()的实例源码

TextEditor.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __init__(self, file):
        self.file = file
        self.scr = curses.initscr()
        self.scr.border()
        self.scr_height, self.scr_width = self.scr.getmaxyx()
        self.text_win = curses.newwin(self.scr_height - 1, self.scr_width, 1, 0)
        self.file_text = file.content
        if self.file_text != None:
            self.text_win.addstr(self.file_text)
        curses.noecho()
        #curses.start_color()
        #curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_GREEN)

        if self.file.exists:
            self.start_editor()
        else:
            curses.endwin()
            gc.error('An error occurred while editing this file.')
ChatSession.py 文件源码 项目:HTP 作者: nklose 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, username):
        os.environ.setdefault('ESCDELAY', '25') # shorten esc delay
        self.username = username

        # set up IRC
        self.channel = "##HTP"

        # set up curses
        self.scr = curses.initscr()
        self.disconnect = False
        curses.start_color()
        self.scr_height, self.scr_width = self.scr.getmaxyx()
        self.chatbar = curses.newwin(5, self.scr_height - 1, 5, 10)
        self.msg_text = ''
        self.logfile = '../data/irc.txt'
        self.log_text = []

        # curses color config
        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_GREEN)

        # start the client
        try:
            curses.wrapper(self.start_loop())
        except Exception as e:
            self.scr.addstr(2, 0, str(e), curses.A_REVERSE)

    # client game loop
tui.py 文件源码 项目:awesome-finder 作者: mingrammer 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def init_layout(self):
        """Initialize the each windows with their size and shape"""
        self.height, self.width = self.window.getmaxyx()

        # Title section
        self.window.addstr(0, 0, '[awesome-{}] Find awesome things!'.format(self.awesome_title), curses.color_pair(1))
        self.window.hline(1, 0, curses.ACS_HLINE, self.width)

        # Search result section
        self.result_window = curses.newwin(self.height - 4, self.width, 2, 0)
        self.result_window.keypad(True)

        # Search bar section
        self.window.hline(self.height - 2, 0, curses.ACS_HLINE, self.width)
        self.window.addch(self.height - 1, 0, '>')
        self.search_window = curses.newwin(1, self.width - 1, self.height - 1, 2)
        self.search_window.keypad(True)

        self.window.refresh()
curses_tests.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_textpad(stdscr, insert_mode=False):
    ncols, nlines = 8, 3
    uly, ulx = 3, 2
    if insert_mode:
        mode = 'insert mode'
    else:
        mode = 'overwrite mode'

    stdscr.addstr(uly-3, ulx, "Use Ctrl-G to end editing (%s)." % mode)
    stdscr.addstr(uly-2, ulx, "Be sure to try typing in the lower-right corner.")
    win = curses.newwin(nlines, ncols, uly, ulx)
    textpad.rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
    stdscr.refresh()

    box = textpad.Textbox(win, insert_mode)
    contents = box.edit()
    stdscr.addstr(uly+ncols+2, 0, "Text entered in the box\n")
    stdscr.addstr(repr(contents))
    stdscr.addstr('\n')
    stdscr.addstr('Press any key')
    stdscr.getch()

    for i in range(3):
        stdscr.move(uly+ncols+2 + i, 0)
        stdscr.clrtoeol()
curses_tests.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def test_textpad(stdscr, insert_mode=False):
    ncols, nlines = 8, 3
    uly, ulx = 3, 2
    if insert_mode:
        mode = 'insert mode'
    else:
        mode = 'overwrite mode'

    stdscr.addstr(uly-3, ulx, "Use Ctrl-G to end editing (%s)." % mode)
    stdscr.addstr(uly-2, ulx, "Be sure to try typing in the lower-right corner.")
    win = curses.newwin(nlines, ncols, uly, ulx)
    textpad.rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
    stdscr.refresh()

    box = textpad.Textbox(win, insert_mode)
    contents = box.edit()
    stdscr.addstr(uly+ncols+2, 0, "Text entered in the box\n")
    stdscr.addstr(repr(contents))
    stdscr.addstr('\n')
    stdscr.addstr('Press any key')
    stdscr.getch()

    for i in range(3):
        stdscr.move(uly+ncols+2 + i, 0)
        stdscr.clrtoeol()
curses_tests.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_textpad(stdscr, insert_mode=False):
    ncols, nlines = 8, 3
    uly, ulx = 3, 2
    if insert_mode:
        mode = 'insert mode'
    else:
        mode = 'overwrite mode'

    stdscr.addstr(uly-3, ulx, "Use Ctrl-G to end editing (%s)." % mode)
    stdscr.addstr(uly-2, ulx, "Be sure to try typing in the lower-right corner.")
    win = curses.newwin(nlines, ncols, uly, ulx)
    textpad.rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
    stdscr.refresh()

    box = textpad.Textbox(win, insert_mode)
    contents = box.edit()
    stdscr.addstr(uly+ncols+2, 0, "Text entered in the box\n")
    stdscr.addstr(repr(contents))
    stdscr.addstr('\n')
    stdscr.addstr('Press any key')
    stdscr.getch()

    for i in range(3):
        stdscr.move(uly+ncols+2 + i, 0)
        stdscr.clrtoeol()
curses_tests.py 文件源码 项目:web_ctp 作者: molebot 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_textpad(stdscr, insert_mode=False):
    ncols, nlines = 8, 3
    uly, ulx = 3, 2
    if insert_mode:
        mode = 'insert mode'
    else:
        mode = 'overwrite mode'

    stdscr.addstr(uly-3, ulx, "Use Ctrl-G to end editing (%s)." % mode)
    stdscr.addstr(uly-2, ulx, "Be sure to try typing in the lower-right corner.")
    win = curses.newwin(nlines, ncols, uly, ulx)
    textpad.rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
    stdscr.refresh()

    box = textpad.Textbox(win, insert_mode)
    contents = box.edit()
    stdscr.addstr(uly+ncols+2, 0, "Text entered in the box\n")
    stdscr.addstr(repr(contents))
    stdscr.addstr('\n')
    stdscr.addstr('Press any key')
    stdscr.getch()

    for i in range(3):
        stdscr.move(uly+ncols+2 + i, 0)
        stdscr.clrtoeol()
curses_tests.py 文件源码 项目:pefile.pypy 作者: cloudtracer 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def test_textpad(stdscr, insert_mode=False):
    ncols, nlines = 8, 3
    uly, ulx = 3, 2
    if insert_mode:
        mode = 'insert mode'
    else:
        mode = 'overwrite mode'

    stdscr.addstr(uly-3, ulx, "Use Ctrl-G to end editing (%s)." % mode)
    stdscr.addstr(uly-2, ulx, "Be sure to try typing in the lower-right corner.")
    win = curses.newwin(nlines, ncols, uly, ulx)
    textpad.rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
    stdscr.refresh()

    box = textpad.Textbox(win, insert_mode)
    contents = box.edit()
    stdscr.addstr(uly+ncols+2, 0, "Text entered in the box\n")
    stdscr.addstr(repr(contents))
    stdscr.addstr('\n')
    stdscr.addstr('Press any key')
    stdscr.getch()

    for i in range(3):
        stdscr.move(uly+ncols+2 + i, 0)
        stdscr.clrtoeol()
curses_tests.py 文件源码 项目:ouroboros 作者: pybee 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def test_textpad(stdscr, insert_mode=False):
    ncols, nlines = 8, 3
    uly, ulx = 3, 2
    if insert_mode:
        mode = 'insert mode'
    else:
        mode = 'overwrite mode'

    stdscr.addstr(uly-3, ulx, "Use Ctrl-G to end editing (%s)." % mode)
    stdscr.addstr(uly-2, ulx, "Be sure to try typing in the lower-right corner.")
    win = curses.newwin(nlines, ncols, uly, ulx)
    textpad.rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
    stdscr.refresh()

    box = textpad.Textbox(win, insert_mode)
    contents = box.edit()
    stdscr.addstr(uly+ncols+2, 0, "Text entered in the box\n")
    stdscr.addstr(repr(contents))
    stdscr.addstr('\n')
    stdscr.addstr('Press any key')
    stdscr.getch()

    for i in range(3):
        stdscr.move(uly+ncols+2 + i, 0)
        stdscr.clrtoeol()
curses_tests.py 文件源码 项目:ndk-python 作者: gittor 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_textpad(stdscr, insert_mode=False):
    ncols, nlines = 8, 3
    uly, ulx = 3, 2
    if insert_mode:
        mode = 'insert mode'
    else:
        mode = 'overwrite mode'

    stdscr.addstr(uly-3, ulx, "Use Ctrl-G to end editing (%s)." % mode)
    stdscr.addstr(uly-2, ulx, "Be sure to try typing in the lower-right corner.")
    win = curses.newwin(nlines, ncols, uly, ulx)
    textpad.rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
    stdscr.refresh()

    box = textpad.Textbox(win, insert_mode)
    contents = box.edit()
    stdscr.addstr(uly+ncols+2, 0, "Text entered in the box\n")
    stdscr.addstr(repr(contents))
    stdscr.addstr('\n')
    stdscr.addstr('Press any key')
    stdscr.getch()

    for i in range(3):
        stdscr.move(uly+ncols+2 + i, 0)
        stdscr.clrtoeol()
ts_top.py 文件源码 项目:transmission_scripts 作者: leighmacdonald 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def top(args):
    scr = curses.initscr()
    #scr.start_color()
    curses.noecho()
    curses.cbreak()
    hx, wm = scr.getmaxyx()
    scr.keypad(True)
    try:
        header = curses.newwin(HEADER_SIZE, wm, 0, 0)
        body = curses.newwin(BODY_SIZE, wm, HEADER_SIZE, 0)
        while True:
            draw_header(header)
            draw_body(body)
            draw_footer(scr)
            sleep(0.2)
    except KeyboardInterrupt:
        curses.nocbreak()
        scr.keypad(False)
        curses.echo()
        curses.endwin()
curses_tests.py 文件源码 项目:kbe_server 作者: xiaohaoppy 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def test_textpad(stdscr, insert_mode=False):
    ncols, nlines = 8, 3
    uly, ulx = 3, 2
    if insert_mode:
        mode = 'insert mode'
    else:
        mode = 'overwrite mode'

    stdscr.addstr(uly-3, ulx, "Use Ctrl-G to end editing (%s)." % mode)
    stdscr.addstr(uly-2, ulx, "Be sure to try typing in the lower-right corner.")
    win = curses.newwin(nlines, ncols, uly, ulx)
    textpad.rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
    stdscr.refresh()

    box = textpad.Textbox(win, insert_mode)
    contents = box.edit()
    stdscr.addstr(uly+ncols+2, 0, "Text entered in the box\n")
    stdscr.addstr(repr(contents))
    stdscr.addstr('\n')
    stdscr.addstr('Press any key')
    stdscr.getch()

    for i in range(3):
        stdscr.move(uly+ncols+2 + i, 0)
        stdscr.clrtoeol()
app.py 文件源码 项目:toot 作者: ihabunek 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _wrapped_run(self, stdscr):
        self.left_width = 60
        self.right_width = curses.COLS - self.left_width

        # Setup windows
        self.top = curses.newwin(2, curses.COLS, 0, 0)
        self.left = curses.newpad(curses.LINES * 2, self.left_width)
        self.right = curses.newwin(curses.LINES - 4, self.right_width, 2, self.left_width)
        self.bottom = curses.newwin(2, curses.COLS, curses.LINES - 2, 0)

        Color.setup_palette()

        # Load some data and redraw
        self.fetch_next()
        self.selected = 0
        self.full_redraw()

        self.loop()
tui.py 文件源码 项目:s2e-env 作者: S2E 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def __init__(self, parent, x, y, w=None, h=None):
        self._children = []
        self._parent = parent

        self._x = x
        self._y = y
        self._h = h
        self._w = w
        self._vcenter, self._hcenter = False, False

        self.set_size(w, h)

        ax, ay = self.get_screen_coords(0, 0)
        self._wnd = curses.newwin(self._h, self._w, ay, ax)

        if parent is not None:
            parent._children.append(self)
ui.py 文件源码 项目:defuse_division 作者: lelandbatey 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, stdscr, label="", x=0, y=0, width=10, height=1):
        self.default_color = 'white-black'
        self.stdscr = stdscr
        self.label = label
        self.x, self.y = x, y
        self.width, self.height = width, height
        self.borderbox = curses.newwin(height + 2, width + 2, y - 1, x - 1)
        self.textinpt = curses.newwin(height, width, y, x)
        self.textinpt.bkgd(' ', colors.get_colorpair(self.default_color))
        self.textinpt.keypad(1)
        self.refresh()
textpad.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_editbox(stdscr):
        ncols, nlines = 9, 4
        uly, ulx = 15, 20
        stdscr.addstr(uly-2, ulx, "Use Ctrl-G to end editing.")
        win = curses.newwin(nlines, ncols, uly, ulx)
        rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
        stdscr.refresh()
        return Textbox(win).edit()
pyStationInfoEdit.py 文件源码 项目:Parallel.GAMIT 作者: demiangomez 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def enter_edit_mode(self, value=None):

        if self.items[self.position]['field'] == 'Comments':
            editwin = curses.newwin(10, 60, self.position+2, 27)
            rectangle(self.window, self.position + 1, 26, self.position + 12, 26 + 61)
        else:
            editwin = curses.newwin(1, 30, self.position+2, 27)

        editwin.attron(curses.color_pair(2))
        curses.curs_set(1)
        if value:
            box = _Textbox(editwin, True, text=value)
        else:
            box = _Textbox(editwin, True, text=self.items[self.position]['value'])

        _Textbox.stripspaces = True

        self.window.refresh()

        while True:
            edit_field = box.edit()
            if not edit_field is None:
                result = self.validate(edit_field.strip())
                if result:
                    self.navigate(1)
                    break
            else:
                break

        curses.curs_set(0)

        self.window.clear()
curses_ui.py 文件源码 项目:huhamhire-hosts 作者: jiangsile 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def sub_selection_dialog(self, pos):
        """
        Draw a `Selection Dialog` on screen used to make configurations.

        :param pos: Index of selected item in `Configure Setting` frame.
        :type pos: int

        .. warning:: The value of `pos` MUST NOT be `None`.

        :return: A **WindowObject** which represents the selection dialog.
        :rtype: WindowObject
        """
        i_len = len(self.settings[pos][2])
        # Draw Shadow
        shadow = curses.newwin(i_len + 2, 18, 13 - i_len / 2, 31)
        shadow.bkgd(' ', curses.color_pair(8))
        shadow.refresh()
        # Draw Subwindow
        screen = curses.newwin(i_len + 2, 18, 12 - i_len / 2, 30)
        screen.box()
        screen.bkgd(' ', curses.color_pair(1))
        screen.keypad(1)
        # Set local variable
        normal = curses.A_NORMAL
        # Title of Subwindow
        screen.addstr(0, 3, self.settings[pos][0].center(12), normal)
        return screen
ncurses.py 文件源码 项目:isar 作者: ilbers 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__( self, x, y, width, height, fg=curses.COLOR_BLACK, bg=curses.COLOR_WHITE ):
            self.win = curses.newwin( height, width, y, x )
            self.dimensions = ( x, y, width, height )
            """
            if curses.has_colors():
                color = 1
                curses.init_pair( color, fg, bg )
                self.win.bkgdset( ord(' '), curses.color_pair(color) )
            else:
                self.win.bkgdset( ord(' '), curses.A_BOLD )
            """
            self.erase()
            self.setScrolling()
            self.win.noutrefresh()
window.py 文件源码 项目:grbl-stream 作者: fragmuffin 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, screen):
        self.screen = screen
        (max_y, max_x) = self.screen.getmaxyx()
        self.window = curses.newwin(5, max_x, self.row, 0)
        self.status = ''
        self.banner = Banner(self.window, self.banner_prefix)

        # Widgets
        self.widgets = {
            'X+': Button(self.window, 'X+', 3, 6),
            'X-': Button(self.window, 'X-', 3, 0),
            'Y+': Button(self.window, 'Y+', 2, 3),
            'Y-': Button(self.window, 'Y-', 4, 3),
            'Z+': Button(self.window, 'Z+', 2, 11),
            'Z-': Button(self.window, 'Z-', 4, 11),
            'jog': NumberLabel(self.window, 1, 6, 0.001),
            'MPosX': NumberLabel(self.window, 2, 21),
            'MPosY': NumberLabel(self.window, 3, 21),
            'MPosZ': NumberLabel(self.window, 4, 21),
            'WPosX': NumberLabel(self.window, 2, 31),
            'WPosY': NumberLabel(self.window, 3, 31),
            'WPosZ': NumberLabel(self.window, 4, 31),
            'feed_rate': Label(self.window, 2, 44, len=20, text='?', prefix='Feed Rate: '),
            'spindle': Label(self.window, 3, 44, len=20, text='?', prefix='Spindle:   '),
        }

        self.render()
        self.refresh()
window.py 文件源码 项目:grbl-stream 作者: fragmuffin 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def init_window(self, row, height):
        self.window = curses.newwin(height, self.screen.getmaxyx()[1], row, 0)
        self.banner = Banner(self.window, self.title)
textpad.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def test_editbox(stdscr):
        ncols, nlines = 9, 4
        uly, ulx = 15, 20
        stdscr.addstr(uly-2, ulx, "Use Ctrl-G to end editing.")
        win = curses.newwin(nlines, ncols, uly, ulx)
        rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
        stdscr.refresh()
        return Textbox(win).edit()
gui.py 文件源码 项目:pycreate2 作者: MomsFriendlyRobotCompany 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, title, w, h, y, x):
        self.win = curses.newwin(h, w, y, x)
        self.win.border(0)
        self.win.addstr(0, 1, title)
gintonic.py 文件源码 项目:gintonic 作者: redahe 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, mainwindow, game_menu):
        self.main = mainwindow
        self.game = game_menu
        size = mainwindow.getmaxyx()
        self.win = curses.newwin(size[0]-5, PREVIEW_WIDTH, 4, GAME_WIDTH + SYSTEM_WIDTH + 2)
        self.last_game_loaded = None
gintonic.py 文件源码 项目:gintonic 作者: redahe 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __init__(self):
        self.swin = curses.newwin(4, 59, 0, 0)
        self.inp = curses.newwin(1, 55, 2, 2)
        self.text = textpad.Textbox(self.inp, insert_mode=False)
        self.history_point = 0
        self.search_history = collections.deque(maxlen=100)
gintonic.py 文件源码 项目:gintonic 作者: redahe 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, mainwindow):
        self.main = mainwindow
        size = mainwindow.getmaxyx()
        self.syswin = curses.newwin(size[0]-5, SYSTEM_WIDTH, 4, 0)
        self.gameswin = curses.newwin(size[0]-5, GAME_WIDTH, 4, SYSTEM_WIDTH)
        self.offset = 0
        self.pos = 0
        self.search_pos = 0
interpreter.py 文件源码 项目:AsciiDots-Java 作者: LousyLynx 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def __init__(self, ticks, silent, debug, compat_debug, debug_lines, autostep_debug, head):
        super().__init__()

        self.ticks = ticks
        self.silent = silent
        self.debug = debug
        self.compat_debug = compat_debug
        self.debug_lines = debug_lines
        self.autostep_debug = autostep_debug
        self.head = head

        self.tick_number = 0

        self.output_count = 0

        if self.debug and not self.compat_debug:
            self.logging_loc = 0
            self.logging_x = 1

            self.stdscr = curses.initscr()

            curses.start_color()

            curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK)
            curses.init_pair(2, curses.COLOR_GREEN, curses.COLOR_BLACK)
            curses.init_pair(3, curses.COLOR_YELLOW, curses.COLOR_BLACK)
            curses.init_pair(4, curses.COLOR_BLUE, curses.COLOR_BLACK)

            curses.noecho()

            curses.curs_set(False)

            self.win_program = curses.newwin(self.debug_lines, curses.COLS - 1, 0, 0)

            self.logging_pad = curses.newpad(1000, curses.COLS - 1)

            def signal_handler(signal, frame):
                    self.on_finish()
                    sys.exit(0)

            signal.signal(signal.SIGINT, signal_handler)
watcher.py 文件源码 项目:nanosat-control 作者: ceyzeriat 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def newlinebox(h, w, y, x, title=None, line=True, opts=None):
    wb = curses.newwin(2, w, y-1, x)
    wb.keypad(True)
    if line:
        wb.addstr(0, 0, e(HORLINE)*w, 0 if opts is None else opts)
    if title is not None:
        wb.addstr(0, 2, e(title),  0 if opts is None else opts)
    pn = curses.panel.new_panel(wb)
    wb.refresh()
    win = curses.newwin(h, w, y, x)
    win.keypad(True)
    panel = curses.panel.new_panel(win)
    return win, panel, wb, pn
textpad.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_editbox(stdscr):
        ncols, nlines = 9, 4
        uly, ulx = 15, 20
        stdscr.addstr(uly-2, ulx, "Use Ctrl-G to end editing.")
        win = curses.newwin(nlines, ncols, uly, ulx)
        rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
        stdscr.refresh()
        return Textbox(win).edit()
ncurses.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def mkpanel(color, rows, cols, tly, tlx):
    win = curses.newwin(rows, cols, tly, tlx)
    pan = panel.new_panel(win)
    if curses.has_colors():
        if color == curses.COLOR_BLUE:
            fg = curses.COLOR_WHITE
        else:
            fg = curses.COLOR_BLACK
        bg = color
        curses.init_pair(color, fg, bg)
        win.bkgdset(ord(' '), curses.color_pair(color))
    else:
        win.bkgdset(ord(' '), curses.A_BOLD)

    return pan


问题


面经


文章

微信
公众号

扫码关注公众号