Double tap on non plot model

I would like to use a double tap event on non plot models such as buttons. The reason I would like to do this is that there I am trying to modify and update the File Selector widget in panel for a project and a PR, and it is limited by this right now.

I checked the code and saw that it was type hinted as plot and tried to use it with a button anyways just in case and it didn’t work

>>> from bokeh.events import DoubleTap
>>> from bokeh.models import Button
>>> b = Button()
>>> DoubleTap(b)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/madelinescyphers/miniconda3/envs/panel_dev/lib/python3.9/site-packages/bokeh/events.py", line 407, in __init__
    super().__init__(model=model)
  File "/Users/madelinescyphers/miniconda3/envs/panel_dev/lib/python3.9/site-packages/bokeh/events.py", line 305, in __init__
    raise ValueError(f"{self.__class__.__name__} event only applies to Plot models")
ValueError: DoubleTap event only applies to Plot models

Is there any work around? Or how hard would this be to implement? I poked around in bokehjs for a little bit and wasn’t sure even where to start if it was to be implemented.

The DoubleTap event definitely currently only functions with plots. It might make sense to support “double” events for buttons in some way, but I doubt it would be done DoubleTap event. Buttons already have a dedicated ButtonClick event and it would be very awkward in API for buttons to support that and DoubleTap but not Tap. So some discussion would be necessary before any future development. Please feel free to start a GitHub development discussion around your use-case and requirements (that’s a better place than this support forum).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.