IntEdit (hwx.gui)#

class IntEdit(value=0, alignment='right', **kwds)#

Bases: LineEdit

A widget that can display/edit an integer.

Attribute Table#

Name

Type

maxValue

property

minValue

property

Method Table#

Name

Description

get (self)

Overloaded method that returns the value as in integer.

validate (self, widget)

Validates whether the value entered is an integer and in [minValue, maxValue] range.

Example

from hwx import gui

# - callbacks --------------------------------------------------------------
def onInputChanged():  # user entered a new value in the input filed
output.text = input.value

def validator(widget):  # method called when to validate the contents
try:    return 0 <= int(widget.value) <= 100
except: return False

# - widgets ----------------------------------------------------------------
# Here we create an IntEdit. When done modifying the IntEdit, the
# output label will update to match its value
input = gui.IntEdit(2, validator=validator, command=onInputChanged)

output = gui.Label(input.value)

frame = gui.HFrame(input, 5, output)

show(frame)
property minValue#

The lower bound of the IntEdit

property maxValue#

The upper bound of the IntEdit

validate(widget)#

Validates whether the value entered is an integer and in [minValue, maxValue] range.

Parameters:

widget (Widget) – The widget where the value is entered.

Returns:

True if the widget value entered is an int, otherwise False.

Return type:

bool

get()#

Overloaded method that returns the value as in integer.