class controls.TextField(Widget)

A TextField provides a simple single-line text entry area. Typed characters are added to the end of the text, and characters are deleted from the end using Delete or Backspace. The text field may be given the keyboard focus by clicking on it.

There is currently no support for selection, copy/paste or tabbing between text fields.

Constructor

TextField(width, font = resource.default_font)
The text field's rect is initialized with the given width and the height of the given font, with top left corner at 0, 0.

Attributes

fg_color
Colour in which to display the text and insertion bar.

font
Font in which to display the text.

text
The current text.

enter_action
A function of no arguments to be called when Return or Enter is pressed. If not specified, Return and Enter key events are passed to the parent widget.

escape_action
A function of no arguments to be called when Escape is pressed. If not specified, Escape key events are passed to the parent widget.
---