[CentralOH] More on PyQt / QML

James Bonanno james at atlantixeng.com
Wed Aug 10 23:09:45 EDT 2016


Following Up from Austin's comments, and more information regarding 
PyQt5 and QML.

What I have found is that the documentation is pretty scattered at this 
point. I have looked at PyQt5 / QML examples from all over GitHub and 
various places on the web. What I am finding is that the release model 
for Qt right now is pretty aggressive; and since I updated to the latest 
version of Qt 5.7 just the other day, my Python code for running the QML 
applications became broken. Additionally, I used the current Golang 
module that supports QML and it was also broken.

However, if I wrap the QML with C++, it runs very nicely. The wrapper 
functionality is somewhat minimized overall, due to the capabilities of 
both QML and javascript. Finally, if I run qmlscene, the QML renders 
natively on the screen in a very nice fashion without any wrappers. (I 
really like this aspect of Qt development with QML, i.e. it is 
conceivable to have a complete app in QML, javascript, and Qt, even 
writing to sqlite databases within the QML framework. )

While the examples on GitHub are tempting, there is not enough attention 
given to dependency tracking and overall compatibility imho. Another 
very frustrating issue with PyQt5 is that to get the latest version, you 
must build from source both the SIP module and PyQt5, and you must be 
careful to use Python3 to run the configure scripts before executing 
make and make install. Riverbank is somewhat aloof about PyQt, despite 
Mark Summerfield's book and all the hoopla about the various ports of Qt 
(Python, Ruby, Ring, Haskell, Rust, Ada, etc.)  This is very annoying.

At this moment in time, I am looking at sticking with PySide and the ui 
designer for Qt, or jumping ship with no life vest and going with QML, 
Javascript and wrappers in C++ as needed. The benefit here would be that 
as PyQt5 support for QML becomes more stabilized, some of these apps 
could be migrated to Python.

I have a new customer who wants high reliable GUI's for an industrial 
application, so trying to stay ahead of the curve and be safe and the 
same time is the essential question.

Hope this helps.

James


On 08/09/2016 12:00 PM, centraloh-request at python.org wrote:
> Message: 1
> Date: Mon, 8 Aug 2016 11:07:10 -0700
> From: Austin Godber<godber at gmail.com>
> To: "Mailing list for Central Ohio Python User Group (COhPy)"
> 	<centraloh at python.org>
> Subject: Re: [CentralOH] QML / Qt versus (Angularjs, Electron, ....)
> Message-ID:
> 	<CAMBaWcU=Xg6_v_PmiznkG1Gtvq50ViLbVm9=S7VEHMs_bAFxcg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi James,
>
> This sounds interesting, is any of your code up on github?  It might be
> interesting to look through.  Have you come across any materials that were
> particularly useful in learning QML/Python/Qt5 development?  It's been
> about a year since I've looked at any GUI development.  I ended up doing a
> little wxwindows and PySide (for licensing reasons).
>
> Austin

On Sun, Aug 7, 2016 at 1:51 PM, James Bonanno<james at atlantixeng.com>  wrote:

> Over the years development of GUI's with Pyside has been my approach, but
> over the last several months have been developing with QML. This is because
> I've found QML to be very powerful. Additionally, PyQt5 supports QML nicely.
>
> I've investigated angularjs, emberjs, backbone, and on and on. I find
> angularjs to be rather clever, but to me the whole thing breaks on a
> fundamental paradigm of how to cleanly design the UI from a programmer's
> perspective.
>
> In contrast, having the qtdesigner in the past enabled a programmer to
> design very nice look GUI's. Today, QtQuick allows that now with QML, and
> even writing the complete description from scratch in QML is pretty
> straightforward.
>
> The one thing I like about QML is the ability to add javascript to
> presentation layer controls; in the past, I've written Python classes with
> decorators to handle all the presentation layer. Effectively, I can
> allocate this layer to javascript within the QML. Additionally, these days,
> you can write your backend for a QML app in either Python or Golang if you
> so choose, and that is a nice touch, in addition to C++.
>
> James

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20160810/6cd43867/attachment.html>


More information about the CentralOH mailing list