Web Analytics Made Easy - Statcounter
Skip to content

Listbox

A List Box. Provide a list of values for the user to choose one or more of. Returns a list of selected rows when a window.read() is executed.

Listbox(
    values,
    default_values = None,
    select_mode = None,
    change_submits = False,
    bind_return_key = False,
    size = (None, None),
    disabled = False,
    auto_size_text = None,
    font = None,
    background_color = None,
    size_px = (None, None),
    text_color = None,
    key = None,
    pad = None,
    tooltip = None
)

Parameter Descriptions

Name Type Default Description
auto_size_text bool None True if element should be the same size as the contents
background_color str None color of background
bind_return_key bool False If True, then the return key will cause a the Listbox to generate an event
change_submits bool False DO NOT USE. Only listed for backwards compat - Use enable_events instead
default_values List[Any] None which values should be initially selected
disabled bool False set disable state for element
font (str or (str, int[, str]) or None) None specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
key str or int or tuple or object None Used with window.find_element and with return values to uniquely identify this element
pad (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) or int None Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int)
select_mode [enum] None Select modes are used to determine if only 1 item can be selected or multiple and how they can be selected. Valid choices begin with "LISTBOX_SELECT_MODE_" and include: LISTBOX_SELECT_MODE_SINGLE LISTBOX_SELECT_MODE_MULTIPLE LISTBOX_SELECT_MODE_BROWSE LISTBOX_SELECT_MODE_EXTENDED
size (int, int) or (int, None) or int (None, None) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1
text_color str None color of the text
tooltip str None text, that will appear when mouse hovers over the element
values List[Any] or Tuple[Any] list of values to display. Can be any type including mixed types as long as they have str method

Class Properties

This class has no public properties

Class Methods

 def get_list_values
 def set_value
 def update

get_list_values

get_list_values()

set_value

set_value(
    values
)

update

update(
    values = None,
    disabled = None
)