[issue33839] IDLE tooltips.py: refactor and add docstrings and tests

Tal Einat report at bugs.python.org
Wed Jun 20 03:36:45 EDT 2018


Tal Einat <taleinat at gmail.com> added the comment:

>> If so, should it be possible for two tooltips to be shown at once, one for the mouse hover and one for the keyboard focus?

> If we have different popup contents, I think 1 at a time would be fine.

Consider the following example: A window with two buttons, each with a tooltip.  The keyboard focus is on one while the mouse hovers over another.

IMO there should never be more than a single tooltip displayed at once (perhaps not including calltips).  We can have tooltips auto-hide when another is displayed (and no-op if itself it attempted to be re-displayed).

Having keyboard focus changes automatically trigger tooltip display (with or without delay) could interact poorly with the above in some cases, e.g. a mouse-hover tooltip suddenly disappearing due to a keyboard delay kicking in and displaying another tooltip.

I'm also not sure keyboard focus should affect tooltips shown by mouse-hover.  If we have tooltips triggered by the keyboard, however, then the "anchor" widget losing keyboard focus should certainly hide the tooltip.  I lean in favor of simplicity and consistency.  IMO any keyboard focus change should likely hide all tooltips.

I suggest the following:

1. Add ability to show tooltips with the keyboard using the same keyboard shortcut as "<<force-open-calltip>>", which defaults to Ctrl+/.  Perhaps as a separate "<<show-tooltip>>" virtual event, or just rename "<<force-open-calltip>>" to that and use it for both.
2. No auto-display of tooltips triggered by a widget receiving keyboard focus.
3. Any keyboard focus change should hide all tooltips and calltips.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33839>
_______________________________________


More information about the Python-bugs-list mailing list