Home » Dropdown List in Kivy

Dropdown List in Kivy

by Online Tutorials Library

Dropdown List in Kivy

The dropdown list is used with custom widgets. The users use the dropdown list for displaying the list of the widgets that are under the displayed widgets. The list of widgets is used for storing any type of widgets, such as images, simple buttons, and many more.

The users can rearrange the position of the dropdown list as it is fully automatic. Furthermore, the developer can place this list in simple ways so that the users can easily select the items from the list.

Important points to remember while developing a dropdown list:

  • When a user adds the widgets, the user should specify their heights manually, so the dropdown can easily calculate the area it would be needing.
  • All the buttons inside the dropdown list should have to trigger the dropdown “DropDown.select()” After it is called, the main button text has to be displayed in the selection of the dropdown.

For working with this widget, the developer should import the following first:

Basic approach for the Dropdown list:

  1. Import the Kivy
  2. Then, import the Kivy app
  3. Then, we will import the dropdown list
  4. And, import the button
  5. We can also see its minimum version, which is optional.
  6. At last, we will import the runTouchApp
  7. We will create the dropdown
  8. Then, we will create the runTouchApp function, which will take the widget as an argument for running the Application.

Example:

Output:

After running the above code, the user will get this output:

Dropdown List in Kivy

And, after clicking on the main button, the dropdown list will open:

Dropdown List in Kivy


Next Topic#

You may also like