from kivy.config import Config
# The 'Config.set()' below disposes of nasty red dot on Windows on two finger tap
# (the recommended workaround for disabling multitouch emulation)
# But makes Dropdown contents unresponsive on Android
# In this example, on Android but not Windows:
# Tap the "hello' button and the dropdown appears.
# Tap anywhere and the dropdown does not respond, a case is never selected,
# or the dropdown dismissed
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
### The remainder of this file is Dropdown 'Basic Example' copied from:
# https://kivy.org/docs/api-kivy.uix.dropdown.html
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)
A common workaround for a Red dot that, on Windows, Kivy paints due a two finger tap is to disable multitouch emulation. On Android this disables Dropdown functionality.
The real problem is Kivy's Red dot. The workaround is simple. But the cause was not intuitive (to me), so please consider trapping this and turning it off.
from sys import platform
if platform == 'win32':
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
A common workaround for a Red dot that, on Windows, Kivy paints due a two finger tap is to disable multitouch emulation. On Android this disables Dropdown functionality.
The real problem is Kivy's Red dot. The workaround is simple. But the cause was not intuitive (to me), so please consider trapping this and turning it off.