pygfx / rendercanvas

One canvas API, multiple backends
https://rendercanvas.readthedocs.io
BSD 2-Clause "Simplified" License
8 stars 0 forks source link

Add backends for all qt libs #17

Closed almarklein closed 1 week ago

almarklein commented 2 weeks ago

When selecting the qt backend via these modules, it can be that rendercanvas.qt has already been imported with another qt-lib. That's why we also do a check to make sure it's actually the intended lib being used.

hmaarrfk commented 2 weeks ago

Out of curiosity is using qtpy that bad?

almarklein commented 2 weeks ago

Out of curiosity is using qtpy that bad?

I think qtpy solves a different problem. We don't really need it because the API that we use of Qt is so small that dealing with the different Qt libs is easily done:

https://github.com/pygfx/rendercanvas/blob/44c2c268f941999efa54f838b8c49f9d968561d7/rendercanvas/qt.py#L33-L48

This PR is really to scratch a little itch that in order to run an example in qt (e.g. for testing stuff) we had to write

import PySide  # this line is needed so rendercanvas.qt knows what lib to use
from rendercanvas.qt import ...

A small annoyance, to be fair, but it felt inconsistent. With this pr I can just replace the "auto" in rendercanvas.auto to "pyside6".

For users using the rendercanvas in a Qt app, I'd recommend to just keep using from rendercanvas.qt ....