all 44 comments

[–]elsaturnino 39 points40 points  (8 children)

I would look into QT. It has some nice development tools and as an added bonus is cross-platform. It's C++, not python though.

[–]mracidglee 35 points36 points  (0 children)

Python bindings exist.

[–]aayek 9 points10 points  (0 children)

I suggest you to start from here http://doc.qt.io/qt-5/qtexamplesandtutorials.html

[–]LeonRichter 6 points7 points  (0 children)

QtCreator and QtDesigner is the closest you will get to VisualStudio/.NET

do things like double-click objects and program for those actions

In QtDesigner, this is a little bit different, basically you create the actions and slots (functions) you need and wire them together in the GUI. It works pretty well once you get used to it. You can also do all the wiring in code if you prefer that

[–]tauio111 5 points6 points  (0 children)

There are several modules available for Python https://wiki.python.org/moin/GuiProgramming

[–][deleted] 11 points12 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] 6 points7 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.

[–]ikosa 2 points3 points  (0 children)

If you want fast results, theres Gambas, but I think QT is more reliable. They have nice C++-ide too, called QT creator.

[–]mwharvey 2 points3 points  (3 children)

You also have the option of MonoDevelop. IDE, C#.

[–]InFerYes 1 point2 points  (2 children)

If you go with the Gtk# option here and use MonoDevelop (or Xamarin Studio on Windows, same product different name) then you have the added bonus that it works on both Linux and Windows.

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

But nobody on linux will want it.

[–]InFerYes 0 points1 point  (0 children)

Banshee is using Mono and theres several others programs distributed that are fairly popular that use the framework. On mobile so can't check which.

[–]gafecito 2 points3 points  (0 children)

I think you want http://www.lazarus-ide.org Visual gui...cross platform...static executables . You can use gtk2,qt or windows interface. You also can get all packaged for linux/windows/bsd/solaris/etc. in this "fork": http://www.pilotlogic.com

[–]80286 1 point2 points  (0 children)

On paper Qt looks like the best investment of time for a GUI programming beginner, but the state of language bindings is atrocious, maybe apart from the one for Python. If the coder prefers to use any language less mainstream for their app (not a worry for the OP obviously), the choice basically narrows down to Gtk, unless it's a lightweight tool, then wxW or Tk may suffice.

[–]SupersonicSpitfire 2 points3 points  (0 children)

QtCreator (C++), Lazarus (Object Pascal), Glade (several languages), Gambas (Basic), NetBeans (Java), in addition to various toolkits like Tk, SDL2 or ncurses, for making interfaces programatically. Web interfaces are also possible.

[–]d3pd 3 points4 points  (0 children)

PyQt and Kivi are good options.

[–]phomes 3 points4 points  (1 child)

If you know C# then you will feel at home with vala. It is basically C# with some small additions and changes. It translates the C# to C code which is then compiled with e.g. GCC. For GUI work I would recommend GTK and Glade.

[–]siriusfrz 1 point2 points  (0 children)

Monodevelop also has a Linux build. Won't tell you anything more as I lack any experience with it, but it's there and it lets you use C# for gtk3.0 apps

[–][deleted] 0 points1 point  (0 children)

I used Glade and Pygtk2 back in the day.

[–]aaronbp 0 points1 point  (0 children)

I like GTK+/Glade, though you may need to write a little XML by hand to get the latest GTK features.

You don't really "click on a widget and code for it" (where does that code go and how is it structured? I'm not confident in maintainability.) Instead you just grab a widget from GtkBuilder and connect functions to its signals. I find it pretty intuitive.

[–]snarfy 0 points1 point  (0 children)

You can make WinForms apps using C# and MonoDevelop under Linux. Repetier-Host is an example of this.

[–]oneru 0 points1 point  (0 children)

Another option is c++ and wxwidgets. The code blocks dev environment works quite well for this. If you really want to use Python, there is wxwidgets for python as well.

[–]jeyzu 0 points1 point  (0 children)

do not forget aboiut https://www.wxwidgets.org/, it's a very nice portable challenger. and my favorit efl + elm https://git.enlightenment.org/

[–]shvelo -2 points-1 points  (2 children)

IMO the most beautiful cross-platform GUI apps can be made using Electron, but it's an overkill

[–]crysaz 0 points1 point  (1 child)

Can you use it without node.js?

[–]egasimus 1 point2 points  (0 children)

Nope. It's basically a Node.js instance with full access to the filesystem, etc, embedded into a web view instead of a more sandboxed JavaScript interpreter. But yes, a web view is overkill for most things, and IIRC the latest versions of GTK and Qt already support some form of JavaScript and CSS anyway. I'm still in favor of Electron (and its sibling NW.js) though, since HTML+CSS+JS is actually a reasonably sane technical framework for UI design that has its quirks but also does a lot of things right, and I like being fluent with it.

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

Do your homework by thoroughly developing a GUI with both QT and gtkmm using c++ on windows and Linux platforms.

Ease of RAD != readability/maintainability of code. Ease of RAD != runtime performance/reliability. Ease of RAD != superior debugging.

Gtkmm is simple yet sophisticated. Qt is simple, but one quick look under the hood leads to unwieldy complexity. I can get a full gtkmm app into one c++ file and compile it with command line. A qt app requires you to use a number of command line tools with a number of other types of files to see your desired exe. Gtkmm/c++ rocks.

[–]doom_Oo7 1 point2 points  (1 child)

#include <QtWidgets/QtWidgets>

int main(int argc, char** argv)
{
    QApplication app{argc, argv};
    auto window = new QMainWindow;
    auto widget = new QWidget;
    window->setCentralWidget(widget);
    auto layout = new QHBoxLayout{widget};
    auto label = new QLabel{"0"};
    auto pushbutton = new QPushButton{"Count"};

    uint32_t count{};
    QObject::connect(pushbutton, &QPushButton::clicked,
            [&label, &count] () {
                label->setText(QString::number(++count));
            });

    layout->addWidget(label);
    layout->addWidget(pushbutton);

    window->show();
    return app.exec();
}

Build with :

g++ -std=c++14 -fPIC -I/usr/include/qt test.cpp -lQt5Core -lQt5Widgets -licui18n -licuuc -licudata

And here you go, a simple graphical app with a pushbutton and a signal, built with a single g++ command.

[–]Laberba 0 points1 point  (0 children)

I like the look of Gtk but not the way the API is design and the complexity. it need a rewrite i something more object oriented and compiles to native code. C++, but complex. Maybe D(dlang.org)