test-kivy-app/kivy_venv/share/kivy-examples/widgets/spinner.py

18 lines
421 B
Python
Raw Normal View History

2024-09-15 12:12:16 +00:00
from kivy.uix.spinner import Spinner
from kivy.base import runTouchApp
spinner = Spinner(
text='Home',
values=('Home', 'Work', 'Other', 'Custom'),
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, 'has text', text)
spinner.bind(text=show_selected_value)
runTouchApp(spinner)