[PyQt] why use the non-gui Qt classes in Python
jnbarchan at gmail.com
Sat Aug 18 11:23:38 BST 2018
On 18 August 2018 at 04:10, Kyle Altendorf <sda at fstab.net> wrote:
> On August 17, 2018 8:18:41 PM EDT, Christopher Probst <
> christop.probst at gmail.com> wrote:
> >These are really great responses. Thank-you so much.
> >In general, I personally take the non-Qt option unless Qt offers a
> >> benefit. I'm much more likely to want to leverage my existing code or
> >> library knowledge without Qt than without Python.
> >I must ask: Why beyond the reason of expanding library knowledge would
> >prefer the non-Qt option? Are there technical reasons like performance,
> >reliability or maintainability?
> They'll be more 'pythonic' generally. You'll get exceptions, iterables
> instead of getWidgetByIndex() functions, yield/await sequencing, etc. Sure,
> also easier to contribute to a Python native library in various regards,
> I'd expect. The libraries will be in common use because they are good on
> their own instead of because they happen to already be present as part of a
> big system ( in other words Qt, though the same idea applies to not
> considering stdlib modules inherently better than third party). I'm not
> saying I'm against Qt stuff, just that I have a tendency away when there
> are good options. Oh, and you are less likely to lose PyPy as an
> alternative to CPython when you want to use the same library without PyQt.
> PyQt mailing list PyQt at riverbankcomputing.com
Why would I use QSQLDatabase, the network module if Python offers it
I think Florian has already mentioned this, but doing a lot of database
stuff I found the Python library ("mysql", I believe) awfully low-level
compared to what the Qt SQL classes offer. Both for backend & frontend
(GUI) functionality, i.e. not *only* because I want to show it in a
I also found QProcess simpler/more powerful that Python os stuff.
OTOH, for path stuff I just opted from the start (newcomer to
Python/Qt) for pathlib, rather than anything Qt. And Python for random OS
things like environment variables.
It has troubled me that I may well have made the wrong decisions. From a
personal point of view, I come from a C background and am happy using the
Qt classes, documentation, consistency, and simply wonderful support
forum. In retrospect perhaps I should have tried to stick to *all* non-UI
stuff in Python. It was actually inheriting code which has the database
stuff half (probably original) with the Python library and half (doubtless
later on) in Qt, which I then had to look at and enhance, which first set
me off moving things over to Qt from Python, so I got biased. This still
gives me sleepless nights, and reading what you guys comment/suggest here
is making me rather depressed that I may not have chosen right/best, hence
this email to let it all out :(
If someone would like to say that the Python MySQL classes are indeed
rubbish and I am at least making the right decision on the Qt database
choice, that would at least cheer me up a bit...? ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt