BindedInputNumber

Introduction

BindedInputNumber widget in Supervisely is a user interface element that allows users to input two numerical values and customize their behavior using the proportional, min, and max properties. With the BindedInputNumber widget, users can fine-tune specific parameters within supervisely apps that require two numerical inputs, such as defining a rectangular region of interest by specifying the x and y coordinates and the width and height. The BindedInputNumber widget provides a convenient and flexible way to input and manage these values, with customizable behavior to ensure accurate and precise inputs.

Function signature

BindedInputNumber(
    width=256,
    height=256,
    min=1,
    max=10000,
    proportional=False,
    widget_id=None,
)

Parameters

ParametersTypeDescription

width

int

Width value

height

int

Weight value

min

int

Minimum allowed value

max

int

Maximum allowed value

proportional

bool

Synchronize changes in width and height parameters

widget_id

str

ID of the widget

width

Determine width value.

type: int

default value: 256

binded_input_number = BindedInputNumber(width=15)

height

Determine height value.

type: int

default value: 256

binded_input_number = BindedInputNumber(height=15)

min

Minimum allowed value.

type: int

default value: 1

max

Maximum allowed value.

type: int

default value: 10000

binded_input_number = BindedInputNumber(
    width=12,
    height=12,
    min=10,
    max=14,
)

proportional

Synchronize changes in width and height parameters.

type: bool

default value: false

binded_input_number = BindedInputNumber(proportional=True)

widget_id

ID of the widget.

type: str

default value: None

Methods and attributes

Attributes and MethodsDescription

value(width: int, height: int)

Set widgets width and height filed.

get_value()

Get input width and height values.

proportional(value: bool)

Set proportional value.

min(value: int)

Set min value.

max(value: int)

Set max value.

disable()

Disable widget.

enable()

Enable widget.

Mini App Example

You can find this example in our Github repository:

ui-widgets-demos/input/004_binded_input_number/src/main.py

Import libraries

import supervisely as sly
from supervisely.app.widgets import Container, BindedInputNumber, Card

Initialize BindedInputNumber widget

binded_input_number = BindedInputNumber()

Create app layout

Prepare a layout for app using Card widget with the content parameter and place widget that we've just created in the Container widget.

card = Card(
    title="Binded Input Number",
    content=Container(widgets=[binded_input_number]),
)

layout = Container(widgets=[card])

Create app using layout

Create an app object with layout parameter.

app = sly.Application(layout=layout)

Last updated