<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">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».</div><div dir="ltr"><br></div><div>There is no perfect tool for everything (nor everybody).</div><div>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.</div><div><br></div><div>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.<br>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.</div><div><br>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.</div><div>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.<br></div><div><br>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).</div><div>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.</div><div>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.<br></div><div>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.</div><div><br></div><div>In conclusion.</div><div><br>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).<br>If you have a more complex GUI, Designer is your friend, especially if you don't have a specific design in mind yet.</div><div>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).</div><div>If you have to use pyuic files, just import them, never touch them, and ignore their contents (if not for learning purposes).<br></div><div><br>Maurizio</div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mer 2 ott 2019 alle ore 01:29 michael h <<a href="mailto:michaelkenth@gmail.com">michaelkenth@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Anyways, just to be direct, I use Designer and it doesn't seem to have <br>
ruined my programs.<br><br></blockquote><div><br></div><div>Going to agree with Kyle on this one. </div><div><br></div><div>Designer has it's place. I'd rather be working on features rather than coding dialogs and other simple windows by hand.</div><div>The ability to do it all by hand is a required skill in my opinion but used correctly designer is a time saver.<br></div><div><br></div><div><br></div></div></div>
_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br><a href="http://www.jidesk.net" target="_blank">http://www.jidesk.net</a></div>