python类textpad()的实例源码

infinite_jukebox.py 文件源码 项目:Remixatron 作者: drensin 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def get_window_contents():
    """Dump the contents of the current curses window."""

    tbox = curses.textpad.Textbox(window)
    tbox.stripspaces = False;

    w_str = tbox.gather()

    return w_str
ncurses.py 文件源码 项目:isar 作者: ilbers 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def __init__( self, x, y, width, height ):
            NCursesUI.Window.__init__( self, x, y, width, height )

# put that to the top again from curses.textpad import Textbox
#            self.textbox = Textbox( self.win )
#            t = threading.Thread()
#            t.run = self.textbox.edit
#            t.start()

    #-------------------------------------------------------------------------#
gintonic.py 文件源码 项目:gintonic 作者: redahe 项目源码 文件源码 阅读 25 收藏 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)
user_input.py 文件源码 项目:pystocker 作者: coffeeandscripts 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def input_n(cursor, scr_bottom, max_stock_range, stock_list, scr_dim):

    stock_input = None
    curses.start_color()
    curses.init_pair(5,curses.COLOR_WHITE,curses.COLOR_BLUE)
    stock_win = curses.newwin(1, 10, scr_dim[0]-1, 0)
    stock_win.bkgd(curses.color_pair(5))
    stock_box = textpad.Textbox(stock_win)
    stock_win.refresh()
    scr_bottom.addstr(0, curses.COLS-20, "   [Enter]Save/Exit")
    scr_bottom.refresh()
    stock_input = stock_box.edit()
    stock_input = stock_input.upper()

    if str(stock_input) != "" and str(stock_input) not in stock_list:
        stocks.add_stock_code(str(stock_input))
        total_stocks = len(stock_list) + 1
        if total_stocks > scr_dim[0] - 6:
            cursor[1] = total_stocks
            cursor[2] = max_stock_range
        else:
            cursor[1] = max_stock_range + 1
            cursor[2] = cursor[1]
    elif str(stock_input) or ((str(stock_input)[0:(len(str(stock_input)) - 2)] and str(stock_input)[len(str(stock_input))])) in stock_list:
        total_stocks = len(stock_list)
        stock_pos = stock_list.index(str(stock_input)) + 1
        cursor[1] = stock_pos
        if total_stocks > max_stock_range:
            cursor[2] = 1
        else:
            cursor[2] = cursor[1]

    return cursor
cli.py 文件源码 项目:unmessage 作者: AnemoneLabs 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, stdscr, ui):
        CursesHelper.init_curses(stdscr)

        self.input_win = self._create_input_window()
        self.output_win = self._create_output_window()
        self.header_win = self._create_header_window()

        self.textpad = None
        self.textpad_validator = _Validator(self)

        self.ui = ui

        self.init_windows()
cli.py 文件源码 项目:unmessage 作者: AnemoneLabs 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def init_windows(self):
        self.input_win.init()
        self.output_win.init()
        self.header_win.init()

        self.textpad = _Textbox(self.input_win, self.ui)
        self.textpad.stripspaces = True
cli.py 文件源码 项目:unmessage 作者: AnemoneLabs 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def read_input(self):
        return self.textpad.edit(self.textpad_validator.validate).strip()


问题


面经


文章

微信
公众号

扫码关注公众号