Copyright (C) 2000-2012 |
GNU Info (python2.1-lib.info)Textbox objectsTextbox objects --------------- You can instantiate a `Textbox' object as follows: `Textbox(win)' Return a textbox widget object. The WIN argument should be a curses `WindowObject' in which the textbox is to be contained. The edit cursor of the textbox is initially located at the upper left hand corner of the containin window, with coordinates `(0, 0)'. The instance's `stripspaces' flag is initially on. `Textbox' objects have the following methods: `edit([validator])' This is the entry point you will normally use. It accepts editing keystrokes until one of the termination keystrokes is entered. If VALIDATOR is supplied, it must be a function. It will be called for each keystroke entered with the keystroke as a parameter; command dispatch is done on the result. This method returns the window contents as a string; whether blanks in the window are included is affected by the `stripspaces' member. `do_command(ch)' Process a single command keystroke. Here are the supported special keystrokes: Keystroke Action ------ ----- Ctrl-A Go to left edge of window. Ctrl-B Cursor left, wrapping to previous line if appropriate. Ctrl-D Delete character under cursor. Ctrl-E Go to right edge (stripspaces off) or end of line (stripspaces on). Ctrl-F Cursor right, wrapping to next line when appropriate. Ctrl-G Terminate, returning the window contents. Ctrl-H Delete character backward. Ctrl-J Terminate if the window is 1 line, otherwise insert newline. Ctrl-K If line is blank, delete it, otherwise clear to end of line. Ctrl-L Refresh screen. Ctrl-N Cursor down; move down one line. Ctrl-O Insert a blank line at cursor location. Ctrl-P Cursor up; move up one line. Move operations do nothing if the cursor is at an edge where the movement is not possible. The following synonyms are supported where possible: Constant Keystroke ------ ----- KEY_LEFT <Ctrl-B> KEY_RIGHT <Ctrl-F> KEY_UP <Ctrl-P> KEY_DOWN <Ctrl-N> KEY_BACKSPACE <Ctrl-h> All other keystrokes are treated as a command to insert the given character and move right (with line wrapping). `gather()' This method returns the window contents as a string; whether blanks in the window are included is affected by the `stripspaces' member. `stripspaces' This data member is a flag which controls the interpretation of blanks in the window. When it is on, trailing blanks on each line are ignored; any cursor motion that would land the cursor on a trailing blank goes to the end of that line instead, and trailing blanks are stripped when the window contents is gathered. automatically generated by info2www version 1.2.2.9 |