from kivy.uix.dropdown import DropDown from kivy.uix.button import Button from kivy.base import runTouchApp # create a dropdown with 10 buttons dropdown = DropDown() for index in range(10): # When adding widgets, we need to specify the height manually # (disabling the size_hint_y) so the dropdown can calculate # the area it needs. btn = Button(text='Value %d' % index, size_hint_y=None, height=44) # for each button, attach a callback that will call the select() method # on the dropdown. We'll pass the text of the button as the data of the # selection. btn.bind(on_release=lambda btn: dropdown.select(btn.text)) # then add the button inside the dropdown dropdown.add_widget(btn) # create a big main button mainbutton = Button(text='Hello', size_hint=(None, None)) # show the dropdown menu when the main button is released # note: all the bind() calls pass the instance of the caller (here, the # mainbutton instance) as the first argument of the callback (here, # dropdown.open.). mainbutton.bind(on_release=dropdown.open) # one last thing, listen for the selection in the dropdown list and # assign the data to the button text. dropdown.bind(on_select=lambda instance, x: setattr(mainbutton, 'text', x)) runTouchApp(mainbutton)
but dropdown does not hide after click on list item or outside of listalways display list.Please help.
It works fine for me on Win10. What platform are you on?
If you want a simple drop down use Spinner.
Here is an example using a DropDown in kv:
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ListProperty
kv = """
<ThreeButtons>:
size_hint_y: None
height: '48dp'
Button:
text: root.texts[0]
on_release: root.parent.parent.select(self.text)
Button:
text: root.texts[1]
on_release: root.parent.parent.select(self.text)
Button:
text: root.texts[2]
on_release: root.parent.parent.select(self.text)
BoxLayout:
orientation: 'vertical'
Button:
id: btn
text: 'Press'
on_release: dropdown.open(self)
on_kv_post: dropdown.dismiss()
size_hint_y: None
height: '48dp'
DropDown:
id: dropdown
on_select:
btn.text = str(args[1])
print(args)
Button:
text: 'First Item'
size_hint_y: None
height: '48dp'
on_release: dropdown.select('First Item')
ThreeButtons:
texts: '1', '2', '3'
ThreeButtons:
texts: '4', '5', '6'
ThreeButtons:
texts: '7', '8', '8'
Label:
text: 'This is a DropDown Test'
"""
class ThreeButtons(BoxLayout):
texts = ListProperty(['0', '0', '0'])
class DDApp(App):
def build(self):
return Builder.load_string(kv)
DDApp().run()
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAJaKc%2B2Sguce%2BCNbCtozDTjTGNH%3DShDAtUbeho-6247_9D5JTQ%40mail.gmail.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/6015796d.1c69fb81.764ad.ff22SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
On Jan 30, 2021, at 9:03 PM, shrikant tyagi <shrikan...@gmail.com> wrote:
Hi ,i am using window 10 but still it did not auto dismiss drop down list .
<79F3F1F8F2204A4A91FDC5F79EFCE6CD.png>
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAJaKc%2B2Sguce%2BCNbCtozDTjTGNH%3DShDAtUbeho-6247_9D5JTQ%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/6015796d.1c69fb81.764ad.ff22SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAJaKc%2B1Kb%2ByUZGqe_%3DihkjgAaQDL535i_fgtDvbMERxBnaVzdw%40mail.gmail.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/2F8FDB96-BC6C-4923-9A2E-E0A3D9D4DDBA%40cox.net.
I suggest updating your graphics drivers: https://www.intel.com/content/www/us/en/support/intel-driver-support-assistant.html
FYI: Here is my log:
[INFO ] [Logger ] Record log in C:\Users\ellio\.kivy\logs\kivy_21-01-31_4.txt
[INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.3.1
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.3.0
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.0
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.3.1
[INFO ] [Kivy ] v2.0.0
[INFO ] [Kivy ] Installed at "C:\Users\ellio\kivy_venv200\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "C:\Users\ellio\kivy_venv200\Scripts\python.exe"
[INFO ] [Factory ] 186 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'4.6.0 - Build 27.20.100.9168'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) UHD Graphics 620'>
[INFO ] [GL ] OpenGL parsed version: 4, 6
[INFO ] [GL ] Shading version <b'4.60 - Build 27.20.100.9168'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [GL ] NPOT texture support is available
[INFO ] [Base ] Start application main loop
[INFO ] [Base ] Leaving application in progress...
From: shrikant tyagi
Sent: Saturday, January 30, 2021 11:09 PM
To: kivy-...@googlegroups.com
Subject: Re: [kivy-users] dropdown list is not working
i also think, may be this install issue , i agin install and run then it again give same issue.
On Sun, Jan 31, 2021 at 11:07 AM Elliot Garbus <elli...@cox.net> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CAJaKc%2B3fkEVRKCwmxqRZikDs5gG%2BFiYTwMVDpt2fSfPvfRNDTA%40mail.gmail.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/6016c269.1c69fb81.f85cf.18adSMTPIN_ADDED_MISSING%40gmr-mx.google.com.