Advertisement

GUI toolkit for Linux

Started by July 08, 2007 04:26 AM
10 comments, last by Ademan555 17 years, 4 months ago
Hello I am looking to create a gui for a program written in c in Linux what are the good and free toolkits are out there that are used to create a gui in linux Please help
The main three off the top of my head are wxWidgets, GTK+, and Qt.

Each of them are fairly different, and have their own set of advantages and disadvantages. wxWidgets and GTK+ are both LGPL but Qt has its own license. I believe Qt is free to use in non-commercial applications, but you have to buy a license in order to sell an application using Qt - you'd need to read up on that if it's relevant to you.

wxWidgets also compiles down to the "native" toolkit - that means GTK+ (or even Motif if you like) on linux, and win32 on windows and whichever mac toolkit it uses. The advantage of this is that unlike GTK+ and Qt, and for example Swing for java, your apps don't look out of place on each different platform.

As a side note GTK+ is the toolkit used in GNOME and Qt used in KDE, so if you are aiming your app at either one, that might affect your decision.

For coding interface, it's obviously a matter of personal preference. You should look at each one to see which you prefer. Qt if I remember is OO based, but doesn't enforce a lot of constraints on how its used. I'm going on a fuzzy memory so you should probably check yourself, but I remember you simply having to declare objects, and call their methods. wxWidgets is also OO based but generally you code by writing your own classes to derive from standard classes and implement your own functionality - ie. its harder to decouple your own code from that of wxWidgets. This might have changed though since I last used it. GTK+ is functional so it is entirely based on calling functions with objects, C-style.

In the end the differences mostly reflect on what you want out of it - none of them has a particularly large advantage over the other.
Advertisement
Qt is licensed under the GPL, which means you can only link to it if your app is under the GPL as well. If you don't want to use the GPL yourself you'll have to buy a commercial Qt license.

As for the GTK/Gnome and Qt/KDE split, Qt apps run fine on Gnome and GTK apps fine on KDE. Most people have both toolkits installed. That said, using the native platform toolkit for the app in question makes thing just slightly easier.

Personally I prefer GTK/Gnome but that's mainly because of the Glade UI constructor.

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

If you're looking for a C toolkit, then Gtk+ and Motif are what you're looking for. I'd go with Gtk+ over Motif any time of the day, but if you want to use Motif, there's a free/open source (FOSS) implementation called LessTif. Gtk+ is FOSS as well.
Quote: Original post by Sander
Qt is licensed under the GPL, which means you can only link to it if your app is under the GPL as well. If you don't want to use the GPL yourself you'll have to buy a commercial Qt license.

As for the GTK/Gnome and Qt/KDE split, Qt apps run fine on Gnome and GTK apps fine on KDE. Most people have both toolkits installed. That said, using the native platform toolkit for the app in question makes thing just slightly easier.

Personally I prefer GTK/Gnome but that's mainly because of the Glade UI constructor.


I meant more for style - if you're wanting your app to fit in with KDE, don't use GTK+ :).

There are also plenty of UI constructors and RAD tools available for wxWidgets, and probably Qt too.
Quote: Original post by Sander
Qt is licensed under the GPL, which means you can only link to it if your app is under the GPL as well. If you don't want to use the GPL yourself you'll have to buy a commercial Qt license.

As for the GTK/Gnome and Qt/KDE split, Qt apps run fine on Gnome and GTK apps fine on KDE. Most people have both toolkits installed. That said, using the native platform toolkit for the app in question makes thing just slightly easier.

Personally I prefer GTK/Gnome but that's mainly because of the Glade UI constructor.


I second this, glade is a wonderful UI constructor and is probably 90% of the reason I use Gtk+. Yet another great thing about glade is that it outputs either xml files or c/c++ code (the code construction is deprecated don't use it) and if you use the xml files you can tweak your application's GUI to great extents without ever recompiling it (a really good thing seeing as gcc always felt a tad sluggish to me).

The only real advantage i see to using Qt is the API feels nicer to the programmer and easier to deal with, that said, gtkmm (c++itized API) and gtk# are both very nice and are probably about as easy to use as Qt if not moreso. And my major beef with Gtk+ is the GObject system which is frankly horriffic, luckily you can get away with not touching it most of the time. And my only other problem with it is the C API which is where you'll have to screw with GObject crap more often.

cheers
-Dan

I'm rather tired; I hope I'm making sense.
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
Advertisement
Quote: Original post by baldurk
I meant more for style - if you're wanting your app to fit in with KDE, don't use GTK+ :)


That's a simple matter of installing the right style. There are GTK styles that match the most popular Qt ones and vice versa. On my GNOME desktop I use Kate a lot (a text editor for those who don't know it) and it looks exactly like my GTK apps. The reverse is even better integrated. If you install gtk-qt-engine then all GTK calls from a GTK application are mapped to Qt which means you'll get the exact same style as your native Qt apps.

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

Another option if you like Gtk+ but want to code in C++ is GFC.
I REALLY like using The Fox Toolkit. It gets updated a lot, is open source...as far as I remember and is very comprehensive. It is also platform independent (Or at least it works on XP, Linux and a bunch of others fairly well).

www.fox-toolkit.net/
Thanks a lot for all the info guys.

I use Gnome/Ubuntu So, I think I will go for Glade/GTK+

I havent used or created GUI in Linux environment before, so I am very excited about this :-)

Regards

This topic is closed to new replies.

Advertisement