Skip to content

build: update pygfx deps#239

Merged
tlambert03 merged 7 commits intopyapp-kit:mainfrom
tlambert03:update-pygfx
Mar 6, 2026
Merged

build: update pygfx deps#239
tlambert03 merged 7 commits intopyapp-kit:mainfrom
tlambert03:update-pygfx

Conversation

@tlambert03
Copy link
Member

@tlambert03 tlambert03 commented Mar 6, 2026

@gselzer

there's one thing that's changed about pygfx/rendercanvas since the last version here and that is that i can't get it to render immediately at the right aspect ratio. any action, even just clicking the canvas, makes it snap into correct ratio. know why?

Screen.Recording.2026-03-05.at.8.23.31.PM.mov

@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.70%. Comparing base (079761e) to head (06da35f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #239      +/-   ##
==========================================
+ Coverage   86.54%   86.70%   +0.15%     
==========================================
  Files          46       46              
  Lines        5196     5198       +2     
==========================================
+ Hits         4497     4507      +10     
+ Misses        699      691       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gselzer
Copy link
Collaborator

gselzer commented Mar 6, 2026

Because we aren't redrawing the canvas on resize, of course 😆

If you check out the pygfx camera controller, a redraw is only triggered on some actions. One of which is clicking on the canvas. Resizes events don't even call that function, or at least my breakpoint isn't hit when I resize...

I think that before, we were redrawing all of the time, with something like:

    def _animate(self) -> None:
        if self._camera is not None:
            self._renderer.render(self._scene, self._camera)
        # Draw again, recursively!
        self._canvas.request_draw(self._animate)

but we took it out to avoid unnecessary draws. I think a better solution is just to redraw in some event handler that captures resizes.

cc @almarklein

@tlambert03 tlambert03 merged commit b16d928 into pyapp-kit:main Mar 6, 2026
61 checks passed
@tlambert03 tlambert03 deleted the update-pygfx branch March 6, 2026 03:14
@almarklein
Copy link

Rendercanvas should schedule a draw whenever the canvas resizes.

@tlambert03
Copy link
Member Author

Do you mean to say "it's a bug if it doesn't"?

@almarklein
Copy link

Do you mean to say "it's a bug if it doesn't"?

Yes, should as if it does not, it's a bug.

@almarklein
Copy link

Oh, but I can indeed reproduce that this does not happen with qt. Looking into it.

@almarklein
Copy link

Fixed in pygfx/rendercanvas#188, and released rendercanvas v2.6.2

@tlambert03
Copy link
Member Author

Thanks as always!

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.

3 participants