Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: activation delay on tooltips #2115

Merged
merged 2 commits into from
Jul 13, 2023

Conversation

v-ein
Copy link
Contributor

@v-ein v-ein commented Jun 23, 2023


name: Pull Request
about: Create a pull request to help us improve
title: Activation delay on tooltips
assignees: @hoffstadt


Description:
This PR adds a couple parameters to tooltips that allow to:

  • Only show the tooltip once the mouse stays still for a while (i.e. don't show it while the mouse is still moving).
  • Hide the tooltip as soon as the mouse starts moving again.

This resembles, more or less, the usual behavior of tooltips on Windows (and maybe in other systems too). It would be nice if the tooltip also stayed still while the mouse is moving, but this would be harder to achieve so I put it aside for the moment.

Concerning Areas:
None.

@v-ein
Copy link
Contributor Author

v-ein commented Jun 23, 2023

Note: in this PR, I've set the delay to a default value of 0.5 second, which works just fine but it's different from how DPG tooltips used to work.

Now on a second thought I'm not sure it was a good decision because it will change the behavior of existing apps... Should we keep the delay as zero by default? What do you think? Should tooltips by default pop up instantly, and whoever wants a delay, will have to specify delay=0.5 in each dpg.tooltip call?

The "current" DPG behavior corresponds to

dpg.tooltip(delay=0, hide_on_activity=False)

A good alternative that I'm striving to is:

dpg.tooltip(delay=0.5, hide_on_activity=True)  # hide_on_activity=False also works fine

I'm not sure which one should become implicit (the default) and which should become explicit. My gut feeling is that we shouldn't break existing tooltip behavior.

@v-ein
Copy link
Contributor Author

v-ein commented Jul 12, 2023

Re my last comment: I've updated the PR, and the default behavior is now exactly the same as in the current DPG 1.9.1. That is, to use the delay, one has to specify it on every tooltip; this way we don't break UX on existing apps.

@hoffstadt hoffstadt merged commit 74c04ba into hoffstadt:master Jul 13, 2023
@v-ein v-ein deleted the feature/tooltip-delay branch July 31, 2023 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants