예제 #1
0
파일: term_test.py 프로젝트: simpkins/amt
def partial_screen_example(args):
    term = Terminal()
    with term.program_mode(altscreen=args.altscreen, height=4) as root:
        root.writeln(0, "The time is now:")
        while True:
            root.writeln(2, "  {}", time.ctime())
            term.flush()
            time.sleep(1)
예제 #2
0
파일: term_test.py 프로젝트: simpkins/amt
def full_screen_example(args):
    examples = [("Input", input_example), ("Catch-All", catchall_example)]
    example_names = [entry[0] for entry in examples]

    term = Terminal()
    with term.program_mode(altscreen=args.altscreen) as root:
        l = term_widgets.FixedListSelection(root, example_names)
        l.redraw()
        while True:
            c = term.getch()
            if c == "q":
                return
            elif c == "j" or c == term_keys.KEY_DOWN:
                l.move_down()
            elif c == "k" or c == term_keys.KEY_UP:
                l.move_up()
            elif c == "\n" or c == "\r":
                l.set_visible(False)
                term.clear()
                example_fn = examples[l.cur_idx][1]
                example_fn(root)
                l.set_visible(True)