MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / Spin

Class Spin

PySimpleGUI/PySimpleGUI.py:3404–3618  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

3402# ---------------------------------------------------------------------- #
3403
3404class Spin(Element):
3405 """
3406 A spinner with up/down buttons and a single line of text. Choose 1 values from list
3407 """
3408
3409 def __init__(self, values, initial_value=None, disabled=False, change_submits=False, enable_events=False, readonly=False, setting=None,
3410 size=(None, None), s=(None, None), auto_size_text=None, bind_return_key=None, font=None, background_color=None, text_color=None, key=None, k=None, pad=None,
3411 p=None, wrap=None,
3412 tooltip=None, right_click_menu=None, expand_x=False, expand_y=False, visible=True, metadata=None):
3413 """
3414 :param values: List of valid values
3415 :type values: Tuple[Any] or List[Any]
3416 :param initial_value: Initial item to show in window. Choose from list of values supplied
3417 :type initial_value: (Any)
3418 :param disabled: set disable state
3419 :type disabled: (bool)
3420 :param change_submits: DO NOT USE. Only listed for backwards compat - Use enable_events instead
3421 :type change_submits: (bool)
3422 :param enable_events: Turns on the element specific events. Spin events happen when an item changes
3423 :type enable_events: (bool)
3424 :param readonly: If True, then users cannot type in values. Only values from the values list are allowed.
3425 :type readonly: (bool)
3426 :param setting: If not None, then this element will be saved in a settings file using the key for the element
3427 :type setting: (Any)
3428 :param size: (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1
3429 :type size: (int, int) | (None, None) | int
3430 :param s: Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used
3431 :type s: (int, int) | (None, None) | int
3432 :param auto_size_text: if True will size the element to match the length of the text
3433 :type auto_size_text: (bool)
3434 :param bind_return_key: If True, then the return key will cause a the element to generate an event when return key is pressed
3435 :type bind_return_key: (bool)
3436 :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
3437 :type font: (str or (str, int[, str]) or None)
3438 :param background_color: color of background
3439 :type background_color: (str)
3440 :param text_color: color of the text
3441 :type text_color: (str)
3442 :param key: Used with window.find_element and with return values to uniquely identify this element
3443 :type key: str | int | tuple | object
3444 :param k: Same as the Key. You can use either k or key. Which ever is set will be used.
3445 :type k: str | int | tuple | object
3446 :param pad: 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)
3447 :type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
3448 :param p: Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used
3449 :type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
3450 :param wrap: Determines if the values should "Wrap". Default is False. If True, when reaching last value, will continue back to the first value.
3451 :type wrap: (bool)
3452 :param tooltip: text, that will appear when mouse hovers over the element
3453 :type tooltip: (str)
3454 :param right_click_menu: A list of lists of Menu items to show when this element is right clicked. See user docs for exact format.
3455 :type right_click_menu: List[List[ List[str] | str ]]
3456 :param expand_x: If True the element will automatically expand in the X direction to fill available space
3457 :type expand_x: (bool)
3458 :param expand_y: If True the element will automatically expand in the Y direction to fill available space
3459 :type expand_y: (bool)
3460 :param visible: set visibility state of the element
3461 :type visible: (bool)

Callers 1

_create_main_windowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected