Kivy — it is a platform independent GUI tool in Python. Since it can run on Android, IOS, Linux, Windows, etc. It is mainly used to develop Android application, but that does not mean that it cannot be used in desktop applications.
To work with a spinner, you need to import:
from kivy.uix.spinner import Spinner
Spinner — it is a widget that provides a quick way to select one value from a set. In the default state, the counter shows its currently selected value. Touching the counter displays a drop-down menu with all other available values from which the user can select a new one. As with the combo box, the counter object can have multiple values, and you can select one of the values. A callback can be attached to the spinner object to receive notifications about the selection of a value from the spinner object.
Basic Approach: 1) import kivy 2) import kivyApp 3) import spinner 4) import Floatlayout (according to need) 5) import window (optional) 6) Set minimum version (optional) 7) Create Layout class: define the clicked function in it 8) Create App class 9) create .kv file (name same as the app class): 1) create Spinner 2) create callback 3) And many more styling as needed 10) return Layout / widget / Class (according to requirement) 11) Run an instance of the class
Below is the implementation:
In the code below, we created a spinner, performed resizing and positioning, and attached a callback to the values.
# Sample Spinn application er in KIVY using a .kv file
# to change kivy settings by by default we use this module config
from kivy.config import Config
# 0 disabled 1 enabled as true / false # You can use 0 or 1 & amp; & amp; True or False
Config. set ( ’graphics’ , ’ resizable’ , True )
# Program to show how to create a radio button # import nodded module
# Your application base class inherits from the application class. # app: always refers to an instance of your applications
from kivy.app import App
# this limits the kivy version ie # below this version you cannot # use the application or software
kivy.require ( ’1.9.0’ )
# Spinner is a widget that provides # a quick way to select one value from a set. # as a drop-down list
from kivy. uix.spinner import Spinner
# the module consists of floatlayout # work with FloatLayout first # you must import it