GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Tooltips, add overlay render pass by kushalkolar · Pull Request #830 · fastplotlib/fastplotlib

Conversation

@kushalkolar

@kushalkolar kushalkolar commented May 20, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
kushalkolar added 3 commits May 20, 2025 03:45
@kushalkolar
add overlay render pass
5ad0a06
@kushalkolar
Graphic accessible in graphics
4689f5b
@kushalkolar
tooltip prototype
e009db0
kushalkolar
kushalkolar commented May 20, 2025
View reviewed changes
Comment thread fastplotlib/layouts/_engine.py
class UnderlayCamera(pygfx.Camera):
class ScreenSpaceCamera(pygfx.Camera):
"""
Same as pygfx.ScreenCoordsCamera but y-axis is inverted.

@kushalkolar kushalkolar May 20, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@almarklein almarklein May 20, 2025

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Something like this? pygfx/pygfx#1092

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kushalkolar kushalkolar mentioned this pull request May 20, 2025
Map Text boundaries to world bounding box if Text is in screen space pygfx/pygfx#967
Closed
kushalkolar added 2 commits May 20, 2025 16:33
@kushalkolar
basic tooltips work
86e238a
@kushalkolar
custom tooltip example
2784ab0
@kushalkolar
kushalkolar marked this pull request as ready for review May 20, 2025 20:45
@kushalkolar
kushalkolar requested a review from clewis7 as a code owner May 20, 2025 20:45
@kushalkolar

kushalkolar commented May 20, 2025

Copy link
Copy Markdown
Member Author

@clewis7 ready for review

Screenshot_20250520_164705

Screenshot_20250520_164713

Screenshot_20250520_164720

Screenshot_20250520_164730

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

Screenshot_20250520_164751

FlynnOConnell reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented May 20, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kushalkolar added 7 commits May 21, 2025 00:54
@kushalkolar
auto tooltips
c22630d
@kushalkolar
black
32cf5fa
@kushalkolar
update iris example, add to __init__
1388b58
@kushalkolar
update docs
13859ec
@kushalkolar
type
8b69cb6
@kushalkolar
comments
fab75b8
@kushalkolar
docstring
97e681e
kushalkolar
kushalkolar commented May 21, 2025
View reviewed changes
Comment thread fastplotlib/layouts/_figure.py
Comment on lines +533 to +534
# overlay render pass
self.renderer.render(self._overlay_scene, self._overlay_camera, flush=False)

@kushalkolar kushalkolar May 21, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
kushalkolar added 2 commits May 21, 2025 01:43
@kushalkolar
add tools dir to api root toctree
3a87a1c
@kushalkolar
forgot to regenerate
49de4a7
@kushalkolar kushalkolar changed the title Tooltips Tooltips, add overlay render pass May 21, 2025
clewis7
clewis7 requested changes May 21, 2025
View reviewed changes

@clewis7 clewis7 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Very nice as always, just a few nitpicky things

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread examples/line_collection/line_stack.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread examples/line_collection/line_stack.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/tools/_tooltip.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/tools/_tooltip.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

kushalkolar
kushalkolar commented May 22, 2025
View reviewed changes
Comment thread fastplotlib/tools/_tooltip.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar @clewis7
Apply suggestions from code review
0da5e38
Co-authored-by: Caitlin Lewis <[email protected]>
@kushalkolar kushalkolar mentioned this pull request May 22, 2025
Legend update_using_camera #835
Closed
clewis7
clewis7 approved these changes May 22, 2025
View reviewed changes
@clewis7
clewis7 merged commit 5cda159 into main May 22, 2025
@clewis7
clewis7 deleted the tooltips branch May 22, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@almarklein almarklein almarklein left review comments
@clewis7 clewis7 clewis7 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

tooltips

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@kushalkolar @almarklein @clewis7
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.