TextInput¶
Bases:
pygame_menu.widgets.core.widget.Widget
Text input widget.
Parameters: - label (str) – Input label text
- textinput_id (str) – ID of the text input
- input_type (str) – Type of data
- input_underline (str) – Character drawn under the input
- cursor_color (tuple) – Color of cursor
- cursor_selection_color (tuple) – Selection box color
- cursor_selection_enable (bool) – Enables selection of text
- copy_paste_enable (bool) – Enables copy, paste and cut
- history (int) – Maximum number of editions stored
- maxchar (int) – Maximum length of input
- maxwidth (int) – Maximum size of the text to be displayed (overflow), if 0 this feature is disabled
- maxwidth_dynamically_update (bool) – Dynamically update maxwidth depending on char size
- onchange (callable, None) – Callback when changing the selector
- onreturn (callable, None) – Callback when pressing return button
- password (bool) – Input string is displayed as a password
- password_char (str) – Character used by password type
- repeat_keys_initial_ms (int, float) – Time in ms before keys are repeated when held
- repeat_keys_interval_ms (int, float) – Interval between key press repetition when held
- repeat_mouse_interval_ms (int, float) – Interval between mouse events when held
- tab_size (int) – Tab whitespace characters
- text_ellipsis (str) – Ellipsis text when overflow occurs (input length exceeds maxwidth)
- valid_chars (list) – List of chars that are valid, None if all chars are valid
- kwargs (any) – Optional keyword-arguments for callbacks
Clear the current text.
Returns: None
Draw the widget shape.
Parameters: surface ( pygame.Surface
) – Surface to drawReturns: None
Returns the value of the text.
Returns: Text inside the widget Return type: str
Update internal variable according to the given events list and fire the callbacks.
Parameters: events (list[ pygame.event.Event
]) – List of pygame eventsReturns: True if updated Return type: bool