I wanted to get a simple combo box like widget using the DropDown class. I can do it using python code, but is it possible using just kv language?
I tried the following. Here's my python code:
class CustomDropDown(DropDown):
pass
class MainForm(BoxLayout):
pass
class MainApp(App):
def build(self):
self.dropdown = CustomDropDown()
self.mainForm = MainForm()
return self.mainForm
def do_something(self):
self.dropdown.open(self.mainForm)
MainApp().run()
And here's the kv file :
<MainForm>:
Button:
text: 'Press'
size_hint: [None,None]
height: '40dp'
on_release: app.do_something()
<CustomDropDown>:
Button:
text: 'First Item'
Label:
text: 'Disabled item'
Button:
text: 'Second Item'
But this is not working. Can you please suggest something? Any help is appreciated.
Yes, it's possible using kivy language.
You can read about DropDownList or Spinner through these links. And also if you want to know more on their working, you might want to check this link for kivy-showcase
I think the code is self explanatory.(on_select method)
This is the main.py file
This is the main.kv file