I have a lot of questions...)
I'm trying to get Kivy to register a double tap as the motion event used to add/remove a widget [ since there is no 'hide this widget option'... maybe in the next update] because a single touch down makes the widget appear and disappear and appear and disappear over and over again (which is annoying).
My code (the important bits) [Python, followed by Kivy]:
class SomeScreen(Screen):
def on_touch_down(touch, *args):
if touch.is_double_tap:
try: self.add_widget(*args)
except: self.remove_widget(*args)
pass
Kivy:
FloatLayout:
on_touch_down:
on_touch_down(nameofwidget)
It is giving a 'KeyError: "is_double_tap"'.
I have also tried this collection of solutions.
is_double_tap:
self.on_touch_down
>>> KeyError: "is_double_tap"
Another solution -
on_touch_down:
self.touch.is_double_tap = try: self.add_widget(nameofwidget), except: self.remove_widget(nameofwidget)
>>> invalid syntax [ at try:]
Another solution:
on_touch_down:
self.on_touch_down.is_double_tap: try [ same as above]
>>> invalid syntax [ at try:]
I think it is important to include that
on_touch_down:
try: self.add_widget(nameofwidget)
except: self.remove_widget(nameofwidget)
with no definition of the on_touch_down function on the Python side, works just fine.