← 返回首页
Improvements to GUI selection and Qt support by almarklein · Pull Request #431 · 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

Improvements to GUI selection and Qt support#431

Merged
kushalkolar merged 9 commits into
fastplotlib:mainfrom
almarklein:gui
Mar 31, 2024
Merged

Improvements to GUI selection and Qt support#431
kushalkolar merged 9 commits into
fastplotlib:mainfrom
almarklein:gui

Conversation

almarklein commented Mar 13, 2024
edited
Loading

Copy link
Copy Markdown
Collaborator

Closes #384

  • Adds a new fpl.utils/gui module where the GUI selection is handled and nothing else.
  • Fastplotlib lists its own GUI preference order, but respects users who override it.
  • Avoid importing multiple GUI libraries.
    • This makes fpl lighter.
    • In my experience importing multiple GUI frameworks can also result in odd bugs.
    • Remove all imports of wgpu.gui.auto except in fpl.utils.gui.
    • Users can still use a custom canvas and thus mix GUI toolkits if they want to go crazy :)
  • The fpl.run() method now matches the GUI backend in use (this was not necessarily the case previously).
  • Support for all modern Qt libraries!
  • The cases where ipywidgets is imported is now conditional (only happens in Jupyter notebook / lab).

Note on performance: The import time is about 0.2 s faster on desktop (because it does not import Jupyter stuff). In the notebook we can expect a similar improvement because glfw and qt are not imported by default (when available).

Copy link
Copy Markdown
Collaborator Author

Ready for review, but I figure you may want to have a code-review before letting CI run 😄

almarklein mentioned this pull request Mar 13, 2024
Comment thread fastplotlib/widgets/image.py Show resolved Hide resolved
Comment thread fastplotlib/layouts/_frame/_frame.py Show resolved Hide resolved
Comment thread fastplotlib/utils/gui.py Show resolved Hide resolved
Comment thread fastplotlib/layouts/_utils.py Show resolved Hide resolved

Copy link
Copy Markdown
Collaborator Author

Funny how pygfx/pygfx#674 gets reported while we're working on this 😄 I think I'll put this PR on hold, and first address the GUI backend selection mechanics. I think your code to check what GUI Jupyter has integrated should be used in wgpu-py. And perhaps it makes sense to provide more ways to influence backend preference, that fpl can then use (in the new gui.py).

Copy link
Copy Markdown
Member

yup makes sense to do it upstream, less wheel reinventing 😄

Copy link
Copy Markdown
Member

After pygfx/wgpu-py#478 it should be possible to greatly simplify this

Copy link
Copy Markdown
Collaborator Author

I made some updates to make it work with the latest wgpu. Ready from my end!

kushalkolar marked this pull request as ready for review March 29, 2024 19:15
kushalkolar requested a review from clewis7 as a code owner March 29, 2024 19:15

Copy link
Copy Markdown
Member

This is really great, thanks! 🥳 . Will merge once wgpu v0.15.1 is on pypi and tests pass

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.

Use qtpy so we can use PySide etc

3 participants

Footer

© 2026 GitHub, Inc.