Example #1
0
def user_submit(auth, assignment, stdscr, contents=''):
    stdscr.clear()
    stdscr.addstr(0, 0, "Which file to submit: (hit ctrl-g to finish)")

    editwin = curses.newwin(5, 30, 2, 1)
    rectangle(stdscr, 1, 0, 1 + 5 + 1, 1 + 30 + 1)
    stdscr.addstr(1 + 5 + 2, 0, contents)
    stdscr.refresh()

    box = Textbox(editwin)

    box.edit()
    message = box.gather().rstrip()
    if message.startswith("!ls"):
        try:
            contents = repr(os.listdir(message[4:]))
        except:
            contents = ''
    try:
        open(message, 'rb').close()
    except:
        return user_submit(auth, assignment, stdscr, contents)

    stdscr.clear()
    stdscr.addstr(
        0, 0, "What should the submission be titled? (hit ctrl-g to finish)")
    editwin = curses.newwin(5, 30, 2, 1)
    rectangle(stdscr, 1, 0, 1 + 5 + 1, 1 + 30 + 1)
    stdscr.refresh()

    box = Textbox(editwin)
    box.edit()

    submit(auth, assignment, message, box.gather().rstrip())
Example #2
0
def add_key_value_pair_below():
    global global_stdscr, last_key_pressed, post_request_body_boxes, PLUS_POS_Y, selected_box, chosen_move_index
    if len(post_request_body_boxes) == 0 or selected_box == len(
            post_request_body_boxes):
        global_stdscr.chgat(TOP + POST_REQUEST_NUM_LINES - 1 + PLUS_POS_Y,
                            LEFT + POST_REQUEST_NUM_COLS + 2 * PADDING, 1,
                            curses.A_REVERSE)

    update_key_value_table()

    if selected_box != -1 and selected_box != len(post_request_body_boxes):
        curses.curs_set(True)
        post_request_body_boxes[selected_box][
            key_or_val_selector + "_box"]["box"].edit(post_navigator)
    elif selected_box == -1 or len(post_request_body_boxes) == selected_box:
        last_key_pressed = global_stdscr.getch()

    if last_key_pressed == ENTER:
        key_editwin = curses.newwin(
            NUM_LINES, NUM_COLS // 2 - 2, TOP + POST_REQUEST_NUM_LINES +
            len(post_request_body_boxes) * 2 * PADDING + 1, LEFT + PADDING + 1)
        key_box = Textbox(key_editwin)
        value_editwin = curses.newwin(
            NUM_LINES, NUM_COLS // 2 - 2, TOP + POST_REQUEST_NUM_LINES +
            len(post_request_body_boxes) * 2 * PADDING + 1,
            LEFT + 3 * PADDING + NUM_COLS // 2 + 1)
        value_box = Textbox(value_editwin)
        selected_box = len(post_request_body_boxes)
        post_request_body_boxes.append({
            "key": "",
            "value": "",
            "key_box": {
                "box":
                key_box,
                "x":
                LEFT + PADDING + 1,
                "y":
                TOP + POST_REQUEST_NUM_LINES +
                len(post_request_body_boxes) * 2 * PADDING + 1,
                "cursor":
                0
            },
            "value_box": {
                "box":
                value_box,
                "x":
                LEFT + PADDING + NUM_COLS // 2 + 1 + 2 * PADDING,
                "y":
                TOP + POST_REQUEST_NUM_LINES +
                len(post_request_body_boxes) * 2 * PADDING + 1,
                "cursor":
                0
            }
        })
        PLUS_POS_Y += 4
    elif last_key_pressed == curses.KEY_UP:
        if selected_box == -1:
            chosen_move_index = move_indexes["edit_message_box"]
        else:
            selected_box = selected_box - 1 if selected_box > 0 else 0
def input():
    editwin = curses.newwin(1, 60, 7, 3)
    rectangle(screen, 6, 2, 6 + 1 + 1, 2 + 60 + 1)
    screen.refresh()
    box = Textbox(editwin)
    box.edit()
    return box.gather()
Example #4
0
    def modify_subtask(self):
        current_subtask = self.controller.get_selected_subtask()
        curs_set(2)
        try:
            from math import ceil
            max_rows = ceil(
                len(current_subtask.description) /
                (self.window.getmaxyx()[1] - 2))

            # Display hint
            self.view.command_window.display_text("Ctrl+G - Save Result")

            edit_win = self.window.subwin(
                max_rows,
                self.window.getmaxyx()[1] - 2, current_subtask.sequence + 3,
                self.view.tasks_window.window.getmaxyx()[1] + 2)
            edit_win.clear()
            edit_win.addstr(0, 0,
                            self.controller.get_selected_subtask().description)
            edit_win.move(0, 0)
            e = Textbox(edit_win, insert_mode=True)
            text = self.controller.sanitize_input(e.edit())
            self.controller.modify_subtask(
                self.controller.get_selected_task().description,
                self.controller.get_selected_subtask().description,
                description=text)
        finally:
            curs_set(0)
            self.render(self.controller.get_subtasks())
            self.notify()
    def create_textbox(self, color_code, default_value=None, validate=None):
        is_valid = False
        data = None
        while(not is_valid):
            self._window.hline(self.y + 1, self.x, "_", 16)
            self._window.refresh()

            new_win = curses.newwin(self.h, self.w,
                                    self.y + self.header_height, self.x)
            text = Textbox(new_win, insert_mode=False)

            if default_value:
                for i in default_value:
                    text.do_command(ord(i))

            data = text.edit()
            if not validate:
                is_valid = True
            elif getattr(Validation, validate)(data.strip()):
                is_valid = True
            else:
                col_code_attr = ColorCode().get_color_pair(3)
                self._obj.on_attr(col_code_attr)
                self._window.addstr(self.header_height - 1,
                                    3,
                                    f"Error: Invalid {validate}"
                                    f" {data.strip()} Please re-enter")
                self._obj.off_attr(col_code_attr)
                self._window.refresh()
        return data
Example #6
0
    def __init__(self, main_window):
        self.main_win = main_window

        screen_max_y, screen_max_x = self.main_win.getmaxyx()
        output_win_num_lines = screen_max_y - _INPUT_TEXT_NUM_LINES - _TITLE_HEIGHT * 2

        output_title_beg_y = 0
        output_win_beg_y = output_title_beg_y + _TITLE_HEIGHT
        input_title_beg_y = output_win_beg_y + output_win_num_lines
        input_win_beg_y = input_title_beg_y + _TITLE_HEIGHT

        self.output_win_title = curses.newwin(_TITLE_HEIGHT, screen_max_x,
                                              output_title_beg_y, 0)
        self.output_win = curses.newwin(output_win_num_lines, screen_max_x,
                                        output_win_beg_y, 0)
        self.input_win_title = curses.newwin(_TITLE_HEIGHT, screen_max_x,
                                             input_title_beg_y, 0)
        self.input_win = curses.newwin(_INPUT_TEXT_NUM_LINES, screen_max_x,
                                       input_win_beg_y, 0)

        self.input_win_tb = Textbox(self.input_win)
        self.input_win_tb.stripspaces = True  # Seems to be broken...

        self._init_title_texts()

        self.output_win.scrollok(True)
Example #7
0
def draw_menu(stdscr):
    k = 0
    # Clear and refresh the screen for a blank canvas
    stdscr.clear()
    stdscr.refresh()
    height, width = stdscr.getmaxyx()

    # Start colors in curses
    curses.start_color()
    curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK)
    curses.init_pair(2, curses.COLOR_RED, curses.COLOR_BLACK)
    curses.init_pair(3, curses.COLOR_BLACK, curses.COLOR_WHITE)

    summoner_name_str = 'Summoner name:'
    start_x_title = int((width // 2) - (len(summoner_name_str)))
    stdscr.addstr(0, start_x_title, summoner_name_str, curses.color_pair(3))
    stdscr.refresh()

    editwin = curses.newwin(1, 17, 0, int((width // 2) + 1))
    box = Textbox(editwin)
    # Let the user edit until Ctrl-G is struck.
    box.edit()
    # Get resulting contents
    message = box.gather()

    while k != ord('q'):
        stdscr.clear()
        stdscr.refresh()
        stdscr.addstr(0, 0, message)
        # Refresh the screen

        # Wait for next input
        k = stdscr.getch()
Example #8
0
def main_control(screen, event, inception_level):
    if event == ord("Q"):
        curses.endwin()
        exit(0)
    if event == ord("D"):
        window_for_done_task(screen)
    if event == ord("T"):
        window_for_undone_task(screen)
    if event == ord("F"):
        curses.flash()
    if event == ord("A"):
        editwin = curses.newwin(1,
                                screen.getmaxyx()[1] - 6,
                                screen.getmaxyx()[0] - 4, 1)
        rectangle(screen,
                  screen.getmaxyx()[0] - 5, 0,
                  screen.getmaxyx()[0] - 3,
                  screen.getmaxyx()[1] - 5)
        screen.refresh()
        box = Textbox(editwin)
        # Let the user edit until Ctrl-G is struck.
        box.edit()
        # Get resulting contents
        message = box.gather()
        Tache().ajouter_tache(message, datetime.now())
        screen.clear()
        print_main_screen(screen)
        print_taches(screen, Tache().get_tache_undone(), "Taches a faire :")
        deal_with_selected(screen, 33, 45,
                           Tache().get_tache_undone(), window_for_undone_task)
Example #9
0
    def _main(self, stdscr):
        try:
            #   stdscr = curses.initscr()
            # Clear screen
            stdscr.clear()
            # remove the cursor
            curses.curs_set(True)
            # remove echo from touched keys
            # curses.noecho()
            self._initPanels(stdscr)

            box = Textbox(self.commandInput)
            #     stdscr.refresh()
            th = Thread(target = self.refreshProbes, name = "Probe-Refresh", daemon = True)
            th.start()
            stdscr.refresh()

            while self.isRunning:
                stdscr.refresh()
                box.edit()
                self.doCommand(box.gather())
                #         commandInput.refresh()

                # listen without entering enter
                # curses.cbreak())
        finally:
            self.isRunning = False
            th.join()
            # let curses handle special keys
            stdscr.keypad(True)
            stdscr.refresh()
            stdscr.getkey()
Example #10
0
    def __edit_box(self,
                   title,
                   input_msg,
                   placeholder="",
                   size=5,
                   is_attachment=False):
        '''Function to show edit text box on screen'''

        curses.curs_set(1)
        self.__set_default_screen(title)
        # self.__stdscr.addstr(0, 0, input_msg)
        _, w = self.__stdscr.getmaxyx()

        number_of_lines = size
        number_of_columns = w - 3

        # create a new window
        editwin = curses.newwin(number_of_lines, number_of_columns, 2, 1)
        rectangle(self.__stdscr, 1, 0, 2 + number_of_lines,
                  2 + number_of_columns)
        if is_attachment:
            self.__stdscr.addstr(number_of_lines + 3, 1,
                                 "* Use ; to separate multiple filepaths")
        self.__stdscr.refresh()

        editwin.insstr(placeholder)

        # Make this new window a textbox to edit
        box = Textbox(editwin)
        # box.stripspaces = True
        box.edit()

        self.__set_default_screen(self.__title, isMain=True)
        curses.curs_set(0)
        return box.gather()
Example #11
0
	def __init__(self, exit_key, curses_window):
		self.screen = curses.initscr()
		self.height, self.width = self.screen.getmaxyx()
		self.window = curses_window
		self.window.nodelay(False)
		self.textbox = Textbox(self.window)
		self.exit_key = exit_key
    def get_user_input(self, text):
        """
        Prints and centers text on screen.
        Creates a new text input where the user enters the player name and returns it.

        Keyword arguments:
        self.screen             -- the curses self.screen.
        text               -- Text that appears before the input.

        Example:
        text = "Insert player 1's name" => Insert player 1's name: (user types here)

        Returns:
        The name of the player that the user entered.
        """

        # Centers the text
        num_rows, num_cols = self.screen.getmaxyx()

        x = int(num_cols / 2) - int(len(text) / 2)
        y = int(num_rows / 2)

        self.screen.addstr(y, x, text)
        self.screen.refresh()

        # We must create a new window becuase the edit function will return
        # everything that has been printed on the self.screen and not just the entered name
        win = curses.newwin(5, 10, y, x + len(text))
        textbox = Textbox(win)
        user_input = textbox.edit(self.validate_key_input)

        return user_input
Example #13
0
    def main(self, stdscr):
        terminal_size = shutil.get_terminal_size()
        self.terminal_width = terminal_size[0]
        self.terminal_height = terminal_size[1]

        # Clear screen
        stdscr.clear()

        #Create the timeline window
        self.timeline_win = self.create_timeline_win()

        #Create the Prompt
        credentials = self.api.VerifyCredentials()
        prompt_win, prompt_width = self.create_prompt_win(
            credentials.screen_name)
        prompt_win.refresh()

        #Create Input window
        edit_line_win = self.create_edit_line_win(prompt_width)
        box = Textbox(edit_line_win, self)
        box.stripspaces = 1

        #Refresh tweets and start loop
        self.do_refresh()
        while True:
            message = box.edit(validate=self.validate_input)
            edit_line_win.clear()
            self.handle_command(message)
Example #14
0
 def editTextField(self, editwin):
     self.setCursorVisibility(1)
     self.textbox = Textbox(editwin, insert_mode=True)
     newname = self.textbox.edit(self.deleteKeyPressHandler).strip()
     self.textbox = ''
     self.setCursorVisibility(0)
     return newname
Example #15
0
def init():
    global stdscr, chatlog_win, input_win, players_win, input_textbox

    stdscr = curses.initscr()
    curses.cbreak()
    curses.noecho()
    stdscr.keypad(1)

    h, w = stdscr.getmaxyx()
    PNW = 20  # player name width
    INH = 4  # input window height

    stdscr.vline(0, w - PNW - 1, curses.ACS_VLINE, h)
    stdscr.hline(h - INH - 1, 0, curses.ACS_HLINE, w - PNW - 1)

    chatlog_win = curses.newwin(h - INH - 1, w - PNW - 1, 0, 0)
    input_win = curses.newwin(INH, w - PNW - 1, h - INH, 0)
    players_win = curses.newwin(h, PNW, 0, w - PNW)

    chatlog_win.idlok(1)
    chatlog_win.scrollok(1)

    players_win.idlok(1)
    players_win.scrollok(1)

    input_textbox = Textbox(input_win)
    input_textbox.stripspaces = True

    stdscr.noutrefresh()
    input_win.noutrefresh()
    players_win.noutrefresh()
    chatlog_win.noutrefresh()

    curses.doupdate()
Example #16
0
def edited_text(scr,
                text,
                y,
                x,
                w=50,
                prompt="Edit the text then Ctrl-G to exit"):
    """
    Provides the editing capability:
    Returns the edited (or not) version of text.
    Editing window begins at (y,x) of the <scr>een,
    consists of 3 rows and is w+2 characters wide.
    Text to be edited appears on line y+1 beginning in column x+1
    within a 'bordered' window with room for w characters or as many
    as are in text, which ever is the greater.
    The <prompt> overwrites the box border in bold.
    """
    #   scr.
    #   scr.refresh()
    if l := len(text) > w: w = l
    # create the text box with border around the outside
    tb_border = cur.newwin(3, w + 2, y, x)
    tb_border.box()
    # place promt on line above the box
    tb_border.refresh()
    scr.addstr(y, x + 2, prompt, cur.A_BOLD)
    scr.refresh()
    tb_body = cur.newwin(1, w, y + 1, x + 1)
    tb = Textbox(tb_body)
    for ch in text:  # insert starting text
        tb.do_command(ch)
    tb.edit()  # start the editor running, Ctrl-G ends
    s2 = tb.gather()  # fetch the contents
    scr.clear()  # clear the screen
    #   return s2
    return s2.strip()
Example #17
0
def feditwin(editwin_loc):
    """
    Create a window to write message in.

    Parameters
    ----------
    editwin_loc: list
        the edit window localisation.

    Returns
    -------
    :class:curses._CursesWindow
        The edit window.
    :class:curses.Textbox
        The textbox to write text in.
    """
    n_line = editwin_loc[2] - editwin_loc[0] or 1
    n_col = editwin_loc[3] - editwin_loc[1]
    y = editwin_loc[0]
    x = editwin_loc[1]

    editwin = newwin(n_line, n_col, y, x)
    editwin.keypad(True)
    box = Textbox(editwin)
    box.edit()
    return editwin, box
Example #18
0
    def setup(self):
        screen = self.screen
        height, width = self.height, self.width = self.screen.getmaxyx()

        # Instruction Pointer and Relative Base
        rectangle(screen, 0, OUTPUT_WIDTH + 3, 2, width - 2)
        self.pointer_win = curses.newwin(1, width - OUTPUT_WIDTH - 6, 1,
                                         OUTPUT_WIDTH + 4)

        # Output
        rectangle(screen, 0, 0, height - 1, OUTPUT_WIDTH + 2)
        self.output_win = curses.newwin(height - 2, OUTPUT_WIDTH, 1, 1)
        self.output = deque(maxlen=height - 2)

        # Array Vis
        rectangle(screen, 3, OUTPUT_WIDTH + 3, height - 4, width - 2)
        self.array_win = curses.newwin(height - 8, width - OUTPUT_WIDTH - 8, 4,
                                       OUTPUT_WIDTH + 5)
        self.array_win.attron(curses.color_pair(1))
        self.cells_per_row = (width - OUTPUT_WIDTH - 8) // CELL_WIDTH
        self.cells = self.cells_per_row * (height - 8)

        # Input
        rectangle(screen, height - 3, OUTPUT_WIDTH + 3, height - 1, width - 2)

        # Input line
        self.input_win = curses.newwin(1, width - OUTPUT_WIDTH - 6, height - 2,
                                       OUTPUT_WIDTH + 4)
        self.text_in = Textbox(self.input_win)

        self.screen.refresh()
        curses.doupdate()
Example #19
0
def main(screen):
    while True:
        screen.clear()

        # command help
        screen.addstr(padding + 14, padding + 0, '* Commands')
        screen.addstr(padding + 15, padding + 0,
                      'Ctrl-G or Enter : send request / Ctrl-C : exit')

        # current resource usage
        screen.addstr(padding + 0, padding + 0, '* Current Usage of Entries')
        printResourceBar(screen)

        # input request
        screen.addstr(padding + 9, padding + 0, '* Enter the request ')
        edit_win = curses.newwin(1, BAR_SIZE, 11 + padding, 1 + padding)
        rectangle(screen, padding + 10, padding + 0, padding + 1 + 10 + 1,
                  padding + 1 + BAR_SIZE + 1)
        screen.refresh()
        box = Textbox(edit_win)
        box.edit()
        input_text = box.gather()

        if input_text != '':
            translateRules(input_text)
            populateRulesetToDP()  # if translation succeed
Example #20
0
def loadPrintScreen(data): #Screen and actions for loading external files
  data.stdscr.clear()
  data.stdscr.addstr(0, 0, "Enter board file name (including '.txt')" +\
    " and press 'enter'")
  boxH,boxW = 1,30
  startY, startX = 3,1
  editwin = curses.newwin(boxH,boxW, startY,startX)
  rectULY, rectULX = 2, 0
  rectangle(data.stdscr, rectULY, rectULX, rectULY+boxH+1, rectULX+boxW+1)
  data.stdscr.addstr(rectULY+boxH+2,0, "Max size is %d x %d." % data.boardMax \
   + "If loaded board "+\
    "is smaller, rows and columns will be added. If too large, rows and"+\
    " columns will be removed until max dimensions acheived. If more space is"+\
    " needed, quit and resize the console window/reduce font size.")
  data.stdscr.refresh()

  box = Textbox(editwin)

  # Let the user edit until Ctrl-G is struck.
  box.edit()

  # Get resulting contents
  userInput = box.gather()
  try:#attempt to load user generated board
    data.lifeBoard = loadBoardState(userInput)
    data.loadedBoardTitle = userInput
    data.boardLoaded = True
    checkBoardSize(data) #fit to size
  except: #Something went wrong...
    data.stdscr.addstr(1,0, "Entered board state not found. "\
      +"Returning to main menu.", curses.color_pair(1) | curses.A_STANDOUT)
    curses.beep()
    data.stdscr.refresh()
    curses.napms(2000)
  data.loadScreen = False
Example #21
0
 def __init__(self, chat_v):
     """
     init for screen in main
     screen = Screen(40, 40, 1, 15, 70, 15, 121, 15, player)
     screen = Screen(40, 40, 43, 120, 15, 72, 15, 121, player, chat)
     Y (first) DOWN
     X (sec) across -> that way
     the 'self.derwin' windows are derivative windows meant to be borders
     still
     """
     self.stdscr = self.initialize()
     self.windows = {}
     self.init_base_windows()
     self.game = Textbox(self.windows["game_commands"])
     self.board_mesg = Textbox(self.windows["current_message"])
     self.chat = chat_v
Example #22
0
File: cli.py Project: kondziu/6p
    def _display(self, text=None, edit=True):
        self._window.refresh()
        self._window.border()

        text_width = self._width - 2
        text_height = self._height - 2

        self._window.addstr(0, 1, "[%s]" % "Your answer"[0:text_width - 2])
        self._window.addstr(self._height - 1, text_width - 8, "[Ctrl+G]")
        #self._window.move(1,1)
        self._window.refresh()

        if edit:
            temporary_edit_window = curses.newwin(text_height, text_width,
                                                  self._y + 1, self._x + 1)
            curses.curs_set(True)

            edit_box = Textbox(temporary_edit_window)
            edit_box.edit()
            curses.curs_set(False)
            content = edit_box.gather().strip()
            del temporary_edit_window

            return content

        else:
            return None
Example #23
0
def send(stdscr, contactId, contactName):
    draw_window(stdscr, "Briar Linux Client",
                "Type your message and press Ctrl+G to send")
    # Centering calculations
    height, width = stdscr.getmaxyx()
    z = 18
    x, y = int((width // 2) - (z // 2) - z % 2), 3
    stdscr.addstr(y - 1, x, "New message for: " + contactName,
                  curses.color_pair(2))

    ncols, nlines = 40, 5
    uly, ulx = 5, 2
    editwin = curses.newwin(nlines, ncols, uly, ulx)
    rectangle(stdscr, uly - 1, ulx - 1, uly + nlines, ulx + ncols)
    stdscr.refresh()

    box = Textbox(editwin)
    # Let the user edit until Ctrl-G is struck.
    box.edit()
    # Get resulting contents
    message = box.gather()

    if message != "":
        url_format = apiURL + "/v1/messages/" + contactId
        response = requests.post(url_format,
                                 headers=auth,
                                 json={"text": message})
        stdscr.addstr(20, 10, "Message sent")
    else:
        stdscr.addstr(20, 10, "Message empty", curses.color_pair(4))
    stdscr.refresh()
    stdscr.getch()

    messages(stdscr, contactId, contactName)
Example #24
0
def testbox():
    myscreen.clear()
    myscreen.border(0)
    editwin = curses.newwin(5, 30, 2, 1)
    rectangle(myscreen, 1, 0, 1 + 5 + 1, 1 + 30 + 1)
    myscreen.refresh()
    box = Textbox(editwin)
    box.edit()
Example #25
0
def command(stdscr, repl_y, repl_x):
    stdscr.addstr(repl_y, 0, ":")
    editwin = curses.newwin(1, repl_x - 1, repl_y, repl_x + 2)
    editwin.refresh()
    stdscr.refresh()
    box = Textbox(editwin)
    box.edit()
    return box.gather()
Example #26
0
 def run_curses(self, win):
     self.setup_win(win)
     self.editwin = win.subwin(1, curses.COLS - 1, curses.LINES - 1, 0)
     editpad = Textbox(self.editwin)
     while not self.closed:
         line = editpad.edit()
         self.editwin.erase()
         if line: self.send_admin(line)
Example #27
0
def edit_box():
    global box, NUM_LINES, NUM_COLS, TOP, LEFT, chosen_option, edit_box_message
    editwin = curses.newwin(NUM_LINES, NUM_COLS - 1, TOP,
                            LEFT + len(chosen_option) + 2)
    box = Textbox(editwin)
    for char in edit_box_message:
        box.do_command(char)
    box.edit(navigator)
Example #28
0
File: GUI.py Project: W4ld3n/b-CD
    def inputCommand(self):
        box = Textbox(self.commandWin)

        # Let the user edit until Ctrl-G is struck.
        box.edit()

        # Get resulting contents
        message = box.gather()
        self.commandWin.clear()
        return message
Example #29
0
	def getText(self, dflt=""):
		offset = 40
		width  = 30
		self.showGetRectangle()
		self.textWin.addstr(0,0,dflt)
		box = Textbox(self.textWin)
		box.edit()
		message = box.gather()
		self.textWin.clear()
		return message.strip()
Example #30
0
def main(stdscr):
    stdscr.addstr(0, 0, "Introduzca mensaje: (Ctrl-G para terminar)")

    editwin = curses.newwin(5, 30, 2,1)
    rectangle(stdscr, 1,0, 1 + 5 + 1, 1 + 30 +1)
    stdscr.refresh()

    box = Textbox(editwin)
    box.edit()  # Let the user edit until Ctrl-G is struck
    message = box.gather()  # Get resulting contents