Web Analytics Made Easy - Statcounter
Skip to content

Spin

A spinner with up/down buttons and a single line of text. Choose 1 values from list

Spin(
    values,
    initial_value = None,
    disabled = False,
    change_submits = False,
    enable_events = False,
    size = (None, None),
    readonly = True,
    auto_size_text = None,
    font = None,
    background_color = None,
    text_color = None,
    key = None,
    pad = None,
    tooltip = None,
    visible = True,
    size_px = (None, None)
)

Parameter Descriptions

Name Type Default Description
auto_size_text bool None if True will size the element to match the length of the text
background_color str None color of background. Can be in #RRGGBB format or a color name "black"
change_submits bool False DO NOT USE. Only listed for backwards compat - Use enable_events instead
disabled bool False set disable state
enable_events bool False Turns on the element specific events. Spin events happen when an item changes
font (str or (str, int[, str]) or None) None specifies the font family, size. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
initial_value Any None Initial item to show in window. Choose from list of values supplied
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) 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)
readonly bool True If True, then users cannot type in values. Only values from the values list are allowed.
size (int, int) or (None, None) (None, None) (w, h) w=characters-wide, h=rows-high
size_px (int, int) or (None, None) (None, None) w=pixels-wide, h=pixels-high
text_color str None element's text color. Can be in #RRGGBB format or a color name "black"
tooltip str None text, that will appear when mouse hovers over the element
values Tuple[Any] or List[Any] List of valid values
visible bool True set visibility state of the element

Class Properties

This class has no public properties

Class Methods

 def get
 def update

get

Return the current chosen value showing in spinbox. This value will be the same as what was provided as list of choices. If list items are ints, then the item returned will be an int (not a string)

get()

Parameter Descriptions

Name Type Default Description
RETURN Any The currently visible entry

update

Changes some of the settings for the Spin Element. Must call Window.Read or Window.Finalize prior

Changes will not be visible in your window until you call window.read or window.refresh.

If you change visibility, your element may MOVE.

update(
    value = None,
    values = None,
    disabled = None,
    background_color = None,
    text_color = None,
    font = None,
    visible = None
)

Parameter Descriptions

Name Type Default Description
background_color str None color of background. Can be in #RRGGBB format or a color name "black"
disabled bool None disable
font (str or (str, int[, str]) or None) None specifies the font family, size. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
text_color str None element's text color. Can be in #RRGGBB format or a color name "black"
value Any None set the current value from list of choices
values List[Any] None set available choices
visible bool None control visibility of element