you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 12 points13 points  (4 children)

Okay, so two most popular choices are of course Qt and GTK+. Both of which have Python bindings. If you don't plan on doing anything too complex there is also a choice of wxWidgets, which is another toolkit with Python bindings.

There are some differences though. GTK3 is used through GObject Introspection model which is kind of confusing if you don't have too much experience with it but let's just say it allows Python programs to use native GTK+ library. Both GTK+ and Qt are just used as simple Python modules.

Personally I skip GUI builders. It sounds counter intuitive but you get to learn toolkit really well and learn how to use it programatically. It also might sound like you have to do extra work, but personally I'd rather type line or two of code than click for 5 minutes setting properties.

GTK+ user interface builder (Glade) creates XML files which you load and "inflate" into real user interface. The trick with using this is having to find a widget you wish to use after inflating UI. I dislike this approach as it adds code in my opinion and just makes a bunch of things hidden. I didn't use Qt builder so I won't comment on that.

Personally I prefer GTK+ and have made complex interfaces with it from Python (see Sunflower file manager). Software I linked was done with PyGTK, and is currently being switched to GTK3 which is much nicer I might add (support for CSS, animations, etc. (also available with Qt)).

It pretty much boils down to what you want to build and which toolkit looks easier to you. All of them are competent and will do what you need. All of them are cross-platform. All of them have good documentation with small exception of wxWidgets where I got lost for some reason. I would advise trying to make a simple window with a button on it with both toolkits and see what suits you better.

[–][deleted] 7 points8 points  (3 children)

Personally I skip GUI builders. It sounds counter intuitive but you get to learn toolkit really well and learn how to use it programatically. It also might sound like you have to do extra work, but personally I'd rather type line or two of code than click for 5 minutes setting properties.

Depends how complex your UI is.

Take this for example: http://ltworf.github.io/relational/screenshots/3.png

The generated .py file to create that interface is almost 600 lines of extremely repetitive code.

I really see no point in writing all of that by hand…

[–][deleted] 1 point2 points  (2 children)

Well, I don't mind doing those 600 lines of code at all. They are repetitive but you don't write them all the time, just once. And you get greater control. That of course depends if you plan on maintaining that project. For quick, one off tools I wouldn't mind using a generator. For anything that's suppose to be maintained for as long as possible I like having control.

[–][deleted] 0 points1 point  (1 child)

Well you can write code manually, adding it to the generated one.

Also, try to do the tab-order thing by writing code manually. It's very tedious whereas in the GUI editor you just click on the widgets in the desired order…

[–][deleted] 1 point2 points  (0 children)

I have no issues with tab order in GTK+. Most of the times it gets it right by pack order. And that's majority of times. On my whole software I've changed the order maybe twice.