Skip to content

enable stack switching with present method screen in pyodide - #258

Merged
almarklein merged 6 commits into
pygfx:mainfrom
Vipitis:run-sync
Oct 15, 2026
Merged

almarklein merged 6 commits into
pygfx:mainfrom
Vipitis:run-sync

Conversation

@Vipitis

@Vipitis Vipitis commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

several weeks of chasing, lead to this.

in order to use run_sync, pyodide makes use of stack switching. Apparently it's not available inside a callback. So chaining the paint once a promise resolves works instead. Maybe has a bit of delay or overhead - but this is needed to get all the complex wgpu, pygfx and fpl stuff to work. (there is an alternative, which would be using bitmap present method).

Large thanks to @pthom who let me know their solution: pthom/imgui_bundle@7c30e58 which I have based the proposed fix on.

before:
before

after:
after

demo of using right click menu in fpl (which would not work earlier):

fpl_rightclick.mp4

Comment thread rendercanvas/pyodide.py Resolved
@almarklein
almarklein merged commit 538681e into pygfx:main Oct 15, 2026
31 checks passed
@Vipitis
Vipitis deleted the run-sync branch October 15, 2026 10:54
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