← 返回首页
Tooltips, add overlay render pass by kushalkolar · Pull Request #830 · fastplotlib/fastplotlib · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Tooltips, add overlay render pass#830

Merged
clewis7 merged 15 commits into
mainfrom
tooltips
May 22, 2025
Merged

Tooltips, add overlay render pass#830
clewis7 merged 15 commits into
mainfrom
tooltips

Conversation

kushalkolar commented May 20, 2025
edited
Loading

Copy link
Copy Markdown
Member

closes #753

  • adds an overlay render pass, I think pygfx plans for a more effiicent overlay render pass later without the depth buffer but I think we can update it to that later when it's available.
  • Tooltip class that can manage displaying tooltips for registered Graphics
    • Figure.tooltip_manager is an Tooltip instance
  • Figure.show_tooltip is a settable property
  • Figure.tooltip_manager.register() is a method than can be used for customizable registration of tooltips.

Usage options:

Auto-register all Graphics that will be added to the figure. Tooltips display the data of the hovered vertex or image array element (either grayscale value or RGB(A) values).

fig = fpl.Figure(..., show_tooltips=True) # to hide tooltips for all graphics in an existing Figure # this basically unregisters all graphics # figure.show_tooltips = False # to show tooltips for all graphics in an existing Figure # this basically registers all current graphics in the figure's subplots # figure.show_tooltips = True

Manually register a tooltip for a Graphic.

fig.tooltip_manager.register( graphic=my_graphic, appear_event="click", # any valid pointer event disappear_event="double_click", # any valid pointer event )

Manually register a tooltip to show custom info by register a function that takes the pointer event and returns a str:

def custom_tooltip_info(ev: PointerEvent): index = ev.pick_info["vertex_index"] info = custom_metadata_object[index] return info fig.tooltip_manager.register( my_graphic, custom_info=custom_tooltip_info, )
tt-2025-05-20_03.50.28.mp4

class UnderlayCamera(pygfx.Camera):
class ScreenSpaceCamera(pygfx.Camera):
"""
Same as pygfx.ScreenCoordsCamera but y-axis is inverted.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

@almarklein would be useful to have a pygfx Camera that is in screenspace with inverted y, pointer events use (0, 0) as the top left corner so it would be useful to have the option.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Something like this? pygfx/pygfx#1092

kushalkolar marked this pull request as ready for review May 20, 2025 20:45
kushalkolar requested a review from clewis7 as a code owner May 20, 2025 20:45

Copy link
Copy Markdown
Member Author

@clewis7 ready for review

Custom tooltips by providing a function that takes the pointer event and outputs a str

github-actions Bot commented May 20, 2025
edited
Loading

Copy link
Copy Markdown

📚 Docs preview built and uploaded! https://www.fastplotlib.org/ver/tooltips

Comment on lines +533 to +534
# overlay render pass
self.renderer.render(self._overlay_scene, self._overlay_camera, flush=False)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

@almarklein the overlay render pass without the depth buffer doesn't exist yet right? we'll just keep this here for now and update later I guess.

kushalkolar changed the title Tooltips Tooltips, add overlay render pass May 21, 2025

clewis7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Very nice as always, just a few nitpicky things

Comment thread examples/line_collection/line_stack.py Outdated Show resolved Hide resolved
Comment thread examples/line_collection/line_stack.py Show resolved Hide resolved
Comment thread fastplotlib/tools/_tooltip.py Show resolved Hide resolved
Comment thread fastplotlib/tools/_tooltip.py Outdated Show resolved Hide resolved
Comment thread fastplotlib/tools/_tooltip.py Outdated Show resolved Hide resolved
Co-authored-by: Caitlin Lewis <69729525+clewis7@users.noreply.github.com>
clewis7 merged commit 5cda159 into main May 22, 2025
clewis7 deleted the tooltips branch May 22, 2025 12:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

tooltips

3 participants

Footer

© 2026 GitHub, Inc.