'How to create a dropdown list in kivy/python?

I want to create a DropDown list in kivy? I referred to the documentation, in which the main Button widget to open the DropDown list is added in the python file itself. However, i would like to add the main Button widget in the associated .kv file and not in the python file.

My code is as follows:

tut10.py

from kivy.app import App
from kivy.uix.dropdown import DropDown
from kivy.uix.gridlayout import GridLayout
from kivy.lang import Builder

class drop_content(DropDown):
    pass

class Grid_5(GridLayout):
    drop = drop_content()

    def show_drop(self):
        self.drop.open()

class Demo_9(App):   

    def build(self):
        return Builder.load_file("kv\Design8.kv")

if __name__ == "__main__":
    Demo_9().run()    

Design8.kv

<drop_content>:

    Label:
        text:"Drop1"
        size_hint_y: None
        height: 44

    Label:
        text:"Drop2"
        size_hint_y: None
        height: 44

Grid_5:    
    cols: 1

    Button:
        text: "Press me !!"
        size_hint: None, None
        on_press: root.show_drop()

The error I am getting is:

File "c:/Users/pavan m sunder/tutorials/Kivy/py/tut10.py", line 19, in show_drop self.drop.open()

TypeError: open() missing 1 required positional argument: 'widget'



Solution 1:[1]

In line 18 try with self.drop.open without ().

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 S.B