Skip to content

number class

A kind of input that handles numbers.

Methods

__init__()

__init__(
    value=None,
    label=None,
    step=1,
    step_multiplier=10,
    min=None,
    max=None,
    change_delay=None, # App config
    on_action=None,
    action_keys="Enter",
    width=None,
    on_change=None,
    propagate=None, # App config
    active=True,
    id=None,
    properties=None,
    class_name=None,
    hover_text=None,
) -> None

Create a new number element.

Parameters:

Name Type Description Default

value

Any
dynamic

The numerical value represented by this control.

None

label

str

The label associated with the input.

None

step

Union[int,float]
dynamic

The amount by which the value is incremented or decremented when the user clicks one of the arrow buttons.

1

step_multiplier

Union[int,float]
dynamic

A factor that multiplies step when the user presses the Shift key while clicking one of the arrow buttons.

10

min

Union[int,float]
dynamic

The minimum value to accept for this input.

None

max

Union[int,float]
dynamic

The maximum value to accept for this input.

None

change_delay

int

Minimum interval between two consecutive calls to the on_change callback.
The default value is defined at the application configuration level by the change_delay configuration option.
if None, the delay is set to 300 ms.
If set to -1, the input change is triggered only when the user presses the Enter key.

App config

on_action

Union[str, Callable]

A function or the name of a function that is triggered when a specific key is pressed.
This function is invoked with the following parameters:

  • state (State): the state instance.
  • id (str): the identifier of the control if it has one.
  • payload (dict): the details on this callback's invocation.
    This dictionary has the following keys:
    • action: the name of the action that triggered this callback.
    • args (list):
      • key name
      • variable name
      • current value
None

action_keys

str

Semicolon (';')-separated list of supported key names.
Authorized values are Enter, Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12.

Enter

width

Union[str, int]

The width of the element.

None

on_change

Union[str, Callable]

A function or the name of a function that is triggered when the value is updated.
This function is invoked with the following parameters:

  • state (State): the state instance.
  • var_name (str): the variable name.
  • value (Any): the new value.
None

propagate

bool

Allows the control's main value to be automatically propagated.
The default value is defined at the application configuration level by the propagate configuration option.
If True, any change to the control's value is immediately reflected in the bound application variable.

App config

active

bool
dynamic

Indicates if this component is active.
An inactive component allows no user interaction.

True

id

str

The identifier that is assigned to the rendered HTML component.

None

properties

dict[str, Any]

Bound to a dictionary that contains additional properties for this element.

None

class_name

str
dynamic

The list of CSS class names that are associated with the generated HTML Element.
These class names are added to the default taipy-number class name.

None

hover_text

str
dynamic

The information that is displayed when the user hovers over this element.

None