Skip to content

TextArea

Create a multi-line text area the user can type into.

TextArea objects are used for entering text that may span several lines. If the text is taller than the area, a scroll bar appears on the right.

Creating a TextArea

You can create a TextArea using the following functions:

TextArea()
TextArea(text, columns, rows, color, font)
Parameter Type Default Description
text str '' The text to start with.
columns int 8 The width of the area, in characters.
rows int 5 The height of the area, in lines.
color Color Color.WHITE The area's background color.
font Font None The font, for example Font("Serif", Font.ITALIC, 16). If omitted, the default font is used.
rotation int or float 0 How far to turn the area, in degrees, counter-clockwise.
visibility int 100 How visible the area is, from 0 (invisible) to 100 (fully visible).

For example,

textarea = TextArea("Start Typing...", 10, 8, Color.YELLOW)

Once created, you can add it to a Display using the Display's add() function.

Functions

Once a TextArea has been created, the following functions are available:

Function Description
getText() Return the text in the area.
setText(text) Set the text in the area.
getColor() Return the area's background color.
setColor(color) Set the area's background color.
getFont() Return the area's font.
setFont(font) Set the area's font.

Additionally, the following common functions are available: