Multi-line text input#

Availability (Key)#

macOS

GTK

Windows

iOS

Android

Web

The Multi-line text input is similar to the text input but designed for larger inputs, similar to the textarea field of HTML.

Usage#

import toga

textbox = toga.MultilineTextInput(id='view1')

Reference#

class toga.widgets.multilinetextinput.MultilineTextInput(id=None, style=None, factory=None, value=None, readonly=False, placeholder=None, on_change=None, initial=None)#

A multi-line text input widget.

Parameters:
  • id (str) – An identifier for this widget.

  • style (Style) – An optional style object. If no style is provided then a new one will be created for the widget.

  • value (str) – The initial text of the widget.

  • readonly (bool) – Whether a user can write into the text input, defaults to False.

  • placeholder (str) – The placeholder text for the widget.

  • on_change (callable) – The handler to invoke when the text changes.

MIN_HEIGHT = 100#
MIN_WIDTH = 100#
clear()#

Clears the text from the widget.

property on_change#

The handler to invoke when the value changes.

Returns:

The function callable that is called on a content change.

property placeholder#

The placeholder text.

Returns:

The placeholder text as a str`.

property readonly#

Whether a user can write into the text input.

Returns:

True if the user can only read, False if the user can read and write the text.

scroll_to_bottom()#

Scroll the view to make the bottom of the text field visible.

scroll_to_top()#

Scroll the view to make the top of the text field visible.

property value#

The value of the multi line text input field.

Returns:

The text of the Widget as a str.