r/learnpython • u/insane_playzYT • Nov 11 '19
Holy shit is QT Designer useful
I love to do UI design. I love to make UIs. And I like to add functionality to things. Thats literally what I can do now. Why did I not know about this sooner. Like a weekend long project could be done in a day or so. Just wanted to come here to express my love for this wonderful program
3
u/1rick Nov 11 '19
How did you pick it up? Any specific tutorial that you did to recommend? (Thanks!)
7
u/insane_playzYT Nov 11 '19
Honestly QtDesigner I kind of picked up on my own. I tinkered with it for a bit, found out what worked and didn't and because I already knew a little bit of PyQt, it was easy to integrate it all together. Tech with Tim has a good series on both PyQt5 and QtDesigner (if you wanna take my approach of just tinkering, watch his first video because it tells you how to fix some issues of installation and whatnot)
Sentdex has a series on PyQt4 which is a bit outdated so I wouldn't recommend it, but hey, it's up to you in the end
16
u/PaulSandwich Nov 11 '19
Link to the Tech w/Tim PyQt5 tutorial playlist: https://www.youtube.com/watch?v=Vde5SH8e1OQ&list=PLzMcBGfZo4-lB8MZfHPLTEHO9zJDDLpYj
Figured since I wanted to look it up I'd save someone else the trouble.
3
u/scanguy25 Nov 11 '19
I had a similar experience.
I spent like a day trying to get a UI with autoscaling working with tkinter.
Did the same in 20 minutes with QT Designer. Wish I had started with that. TKinter is easier for very very simple applications, but anything beyond all the quirks of TK end up eating any time you may have saved.
2
u/tomanonimos Nov 11 '19
Keep in mind that QT Designer has licensing requirements when you use it for anything out of personal use. This is why a lot of people default to Tkinter for small-scale projects.
1
0
u/RufusAcrospin Nov 17 '19
That’s not right, Check this stackexchange post, please: https://opensource.stackexchange.com/questions/7709/using-qt-designer-to-create-ui-design-for-closed-source-application
1
u/tomanonimos Nov 17 '19
You still have to ensure your application meets the LGPL licensing scheme. A lot of people doing small projects don't want to deal with that or be vulnerable to licensing issues. I stand with what I said before.
1
u/RufusAcrospin Nov 17 '19
If I’m not mistaken, LGPL will let you distribute any non-derivative product as you wish, and LGPv3 states that derivative works (like changing a Qt libray) must be distributed under LGPL, but this restriction doesn’t apply to the application using said derivative work.
Btw, I’m not a lawyer, this is just what I gathered from the net, so don’t quote me on this one :-)
3
u/ejpusa Nov 11 '19
You may want to add SwiftUI to your toolbox. Apple’s UI tools are mind blowing. :-)
1
u/maelinya Nov 11 '19
Oh this is nice to know. I need to make a GUI for an application I've been working on -- maybe this will help!
1
1
Nov 12 '19 edited Nov 12 '19
It's great but use it with caution. Most users, mostly newbies create UIs with static widgets that have absolute coordinates. This may work, but it's usually bad practice since users might want to resize the application or the app will need to resize itself to fit contents. Using containers is also often neglected, but it's really important when creating more complex UIs.Furthermore QTDesigner creates very "ugly" code, it's mostly flat and unreadable. You usually want to avoid that in larger or more complex projects.
QTDesigner is amazing for creating mock-ups, exploring widget functionality and reverse-engineering stuff, but I wouldn't personally use it for serious development, especially if you create dynamically generated UIs or multiple tabs/windows/levels.
1
u/RufusAcrospin Nov 17 '19
I’m using it for creating production tool’s UI and there’s nothing wrong with, I can inject custom widgets in runtime, having tabs, etc.
The generation of output files (c++/h or py) should be customizable and cleaner a little bit, but it’s a perfectly fine tool, especially for building complex layouts. It’s fast, the preview is instant (without building), etc.
1
0
Nov 11 '19
[deleted]
10
-99
u/insane_playzYT Nov 11 '19
No. A weekend is 2 days if I remember correctly
19
0
0
Nov 12 '19
[deleted]
2
u/insane_playzYT Nov 12 '19
Haven't really used Tkinter much, so this might be a bit biased, but I would tbh. It's automatically cross platform (for the most part), it's easy to pick up on, and I'd say productivity is also better
0
Nov 11 '19
[deleted]
3
1
u/RufusAcrospin Nov 17 '19
Please, don’t spread misinformation, the license has an Exception which let us distribute the output under our own terms: https://opensource.stackexchange.com/questions/7709/using-qt-designer-to-create-ui-design-for-closed-source-application
1
Nov 17 '19
It looks like that is specifically related to Qt Designer, which is under GPL.
The entire Qt suite is either GPL or LGPL as far as I know, and a responsible developer should be aware of the licenses that govern the code they use, and where they may need to buy a different license.
0
Nov 11 '19
[deleted]
1
u/spatiallydumb Nov 11 '19
This is exactly my experience. It offers convenience at the cost of complexity, and if the end result isn't exactly what you wanted, then you're going to be stuck solving problems that could have easily been avoided.
But to each their own. Some people like Notepad, and some people like MSPaint.
1
u/Thecrawsome Nov 11 '19
but you're gonna outgrow it quickly.
What do you use now?
4
u/ericula Nov 11 '19
Not OP but I just build most GUIs by hand nowadays. I used Qt Designer a lot when I was still getting used to Qt, but building GUIs by hand gives me more flexibility and it results in tidier code.
1
u/Namensplatzhalter Intermediate Beginner Nov 11 '19
it results in tidier code.
dude... so true. converting a .ui file via pyuic results in a big blob of code which you have to comb through and sort by hand. have done this for my current project, so i don't recommend. i'll definitely build my next gui by hand.
1
u/RufusAcrospin Nov 17 '19
You shouldn’t be concerned by the generated code at all, you shouldn’t even touch it (just like the comment indicates on top).
4
Nov 11 '19
I do Qt without the designer. Just writing the UI code directly.
2
u/chzaplx Nov 11 '19
Yeah, I dove into PyQt and found just writing the raw code it can be picked up pretty quickly.
1
u/RufusAcrospin Nov 17 '19 edited Nov 17 '19
That’s mist likely caused by using static/hardcoded size and positon, or otherwise messed up layout.
0
31
Nov 11 '19 edited Nov 11 '19
[removed] — view removed comment
13
u/Username_RANDINT def get_random_int(): return "RANDINT" # TODO Nov 11 '19
Note that Glade creates files to be used with the GTK framework, not Qt. Although I really like GTK (and Glade), it's probably not the best solution for proper cross-platform applications.
-24
Nov 11 '19 edited Nov 11 '19
[removed] — view removed comment
25
u/NuBRandsta Nov 11 '19 edited Nov 11 '19
i'll
nevernow know why you got 17 downvotes30
u/John_Yuki Nov 11 '19
The comment originally was "Sexyyoufind yourdreamjob." - so that's probably why.
17
1
1
16
u/Nixellion Nov 11 '19
I actually got quite used to hand coding QT, especially the ability to dynamically generate UI elements, is it something you can easily do with designer?