Spinner

New in version 1.4.0.

_images/spinner.jpg

Spinner is a widget that provide a quick way to select one value from a set. In the default state, a spinner show its currently selected value. Touching the spinner displays a dropdown menu with all other available values. from which the user can select a new one.

Example:

from kivy.base import runTouchApp
from kivy.uix.spinner import Spinner

spinner = Spinner(
    # default value showed
    text='Home',
    # available values
    values=('Home', 'Work', 'Other', 'Custom'),
    # just for positioning in our example
    size_hint=(None, None),
    size=(100, 44),
    pos_hint={'center_x': .5, 'center_y': .5})

def show_selected_value(spinner, text):
    print 'The spinner', spinner, 'have text', text

spinner.bind(text=show_selected_value)

runTouchApp(spinner)
class kivy.uix.spinner.Spinner(**kwargs)

Bases: kivy.uix.button.Button

Spinner class, see module documentation for more information

dropdown_cls

Class used to display the dropdown list when the Spinner is pressed.

dropdown_cls is a ObjectProperty, default to DropDown.

is_open

By default, the spinner is not open. Set to true to open it.

is_open is a BooleanProperty, default to False.

New in version 1.4.0.

option_cls

Class used to display the options within the dropdown list displayed under the Spinner. The text property in the class will represent the value.

The option class require at least:

  • one text property where the value will be put
  • one on_release event that you need to trigger when the option is touched.

option_cls is a ObjectProperty, default to SpinnerOption.

values

Values that can be selected by the user. It must be a list of strings.

values is a ListProperty, default to [].

class kivy.uix.spinner.SpinnerOption(**kwargs)

Bases: kivy.uix.button.Button

Special button used in the dropdown list. We just set the default size_hint_y and height.