Number Input

The Number input is a text input box that is limited to numeric input.

../../_images/NumberInput.jpeg

Usage

import toga

textbox = toga.NumberInput(min_value=1, max_value=10)

Supported Platforms

Component iOS win32 web django cocoa gtk android
NumberInput no yes no no yes yes no

Reference

class toga.interface.widgets.numberinput.NumberInput(id=None, style=None, min_value=0, max_value=100, step=1, **ex)

Widget for input of a number

Instantiate a new instance of the Number input widget

Parameters:
  • id (str) – An identifier for this widget.
  • style (colosseum.CSSNode) – an optional style object. If no style is provided then a new one will be created for the widget.
  • min_value (int) – Minimum value (default 0)
  • max_value (int) – Maximum value (default 100)
  • step (int) – Step of the adjustment buttons
add(child)

Add a widget as a child of this one.

Raises an ValueError if this widget is a leaf, and cannot have children.

Parameters:child (toga.Widget) – The child to add to the widget
app

The App to which this widget belongs.

Return type:toga.App
children

The children of this node.

This always returns a list, even if the node is a leaf and cannot have children.

Return type:list
Returns:A list of the children for this widget
hide()

Hide the widget from the super view.

id

The node identifier. This id can be used to target CSS directives

Return type:str
parent

The parent of this node.

Return type:toga.Widget
set_font(font)

Set a font on this widget.

Parameters:font (toga.Font) – The new font
show()

Show the widget on the super view.

style

The style object for this widget.

Returns:The style for this widget
Return type:colosseum.CSSNode
value

Current value

Return type:int
Returns:The current value
window

The Window to which this widget belongs.

Return type:toga.Window