[PyQt] Doubt

Dennis Jensen djensen at pgcontrols.com
Wed Oct 2 21:01:49 BST 2019


Okay then I am going to agree to disagree because in my many years of 
experience is that any black-box piece of software that you add to your 
code especially the one that handles your UI is going to be just a pain 
to work with sooner or later as you try to do various things with it.  
And frankly really slapping a window together using normal PyQt is just 
as easily done as it would be to create if via the Designer but when you 
are done you have solid code you can work with it and not some complex 
black-box that you have to do back-flips with just to get it do rather 
simple things.

So yes there is no perfect tool but when a tool is created that makes 
something worse to work with that is not to me a effectively tool -- 
okay sure if you are creating something that does not need to be 
interfaced with via your code then go for it but as soon as your code 
needs to interact with that GUI (like most programs do) you going to 
have issues.

On 10/1/2019 9:01 PM, Maurizio Berti wrote:
> As the "law of the instrument" says, «if the only tool you have is a 
> hammer, [you] treat everything as if it were a nail».
>
> There is no perfect tool for everything (nor everybody).
> I use to create simpler interfaces directly in code, but for 
> more complex situations I prefer Designer, as it allows to fix or 
> change the layout very easily.
>
> In my opinion, the real problem with Designer is that most people 
> (usually those who are new to Qt or python) don't realize that its 
> output should be left as it is, especially the pyuic generated files; 
> what happens there instead is that those people believe that they 
> should write their programs within those py files. I remember doing 
> the same myself when I began exploring PyQt.
> Being automatically generated, those files contain lots of code that 
> in most cases is almost useless, particularly to those 
> inexperienced users; it's what happens with any WYSIWYG editor.
>
> When dealing with mid to advanced GUIs (multi-level nested layouts or 
> stacked widgets), the common (not absolute!) suggestion is to use 
> Designer, as it *is* a time saver: it allows to easily see if the 
> interface _works_ from an UX point of view while drawing it, and 
> eventually change the whole layout in a matter of seconds - something 
> that would take minutes (if not hours) if the interface is coded.
> Most importantly, when you can use a graphical editor for a GUI, you 
> can really focus *only* on creating the interface, without thinking 
> about good object names (which can be done once the layout is 
> finished), code consistency and, obviously, syntax.
>
> One of my programs has a window that contains more than 200 widgets 
> with up to 6 levels of nested layouts (it's a synthesizer editor, and 
> almost all controls *have* to be on a single window).
> Using Designer I was able to create the basic skeleton in less than 10 
> minutes, with less than an hour of fine-tuning and object 
> naming/property setting.
> In the earlier version I couldn't use Designer because most widgets 
> couldn't be just "promoted" (I use custom widget plugins now), coding 
> the whole interface literally took me at least a dozen hours: dealing 
> with that amount of layouts and widgets requires careful organization, 
> and it's not easy to fix or change things with more than 400 lines of 
> layout "code flow"; most of the time is taken by continuously 
> switching between coding and running to see if the result worked, both 
> aesthetically and from an UX perspective (or if it worked at all ;-) 
> ), and eventually go back to the code, remember the object name you 
> need to fix or change, find it and finally edit hoping that you're not 
> breaking something.
> And if I decide to rethink the whole layout, now it would just be a 
> matter of 5-10 minutes of drag'n'drop from the existing interface to a 
> new one.
>
> In conclusion.
>
> For basic and simple interfaces, coding is usually simpler and better 
> (no need to import a 2k file with useless data for a dialog with 3 
> buttons and a label).
> If you have a more complex GUI, Designer is your friend, especially if 
> you don't have a specific design in mind yet.
> If you can, directly use the ui files (use PyQt5.uic.loadUi to load 
> them, careful with file paths though): sometimes it happens that you 
> update the ui but forget to generate the py file).
> If you have to use pyuic files, just import them, never touch them, 
> and ignore their contents (if not for learning purposes).
>
> Maurizio
>
> Il giorno mer 2 ott 2019 alle ore 01:29 michael h 
> <michaelkenth at gmail.com <mailto:michaelkenth at gmail.com>> ha scritto:
>
>
>         Anyways, just to be direct, I use Designer and it doesn't seem
>         to have
>         ruined my programs.
>
>
>     Going to agree with Kyle on this one.
>
>     Designer has it's place. I'd rather be working on features rather
>     than coding dialogs and other simple windows by hand.
>     The ability to do it all by hand is a required skill in my opinion
>     but used correctly designer is a time saver.
>
>
>     _______________________________________________
>     PyQt mailing list PyQt at riverbankcomputing.com
>     <mailto:PyQt at riverbankcomputing.com>
>     https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
>
>
> -- 
> È difficile avere una convinzione precisa quando si parla delle 
> ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi
> http://www.jidesk.net
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20191002/a22e9da3/attachment-0001.html>


More information about the PyQt mailing list