Skip to content

Input

Input

Bases: Widget

A text input widget.

cursor_width: int property

The width of the input (with extra space for cursor at the end).

Changed

Bases: Message

Value was changed.

Attributes:

Name Type Description
value str

The value that the input was changed to.

input Input

The Input widget that was changed.

Submitted

Bases: Message

Sent when the enter key is pressed within an Input.

Attributes:

Name Type Description
value str

The value of the Input being submitted..

input Input

The Input widget that is being submitted.

__init__(value=None, placeholder='', highlighter=None, password=False, name=None, id=None, classes=None)

Initialise the Input widget.

Parameters:

Name Type Description Default
value str | None

An optional default value for the input.

None
placeholder str

Optional placeholder text for the input.

''
highlighter Highlighter | None

An optional highlighter for the input.

None
password bool

Flag to say if the field should obfuscate its content. Default is False.

False
name str | None

Optional name for the input widget.

None
id str | None

Optional ID for the widget.

None
classes str | None

Optional initial classes for the widget.

None

insert_text_at_cursor(text)

Insert new text at the cursor, move the cursor to the end of the new text.

Parameters:

Name Type Description Default
text str

New text to insert.

required