Sign in to follow this  
Muksitul

GUI toolkit for Linux

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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/

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Just make sure you use Glade3 and not Glade2. Not sure if Glade3 is already in the Ubuntu repros. If you do use Glade2, make sure you keep the XML formats and use libglade to load them. Don't export your UI to C code!

Share this post


Link to post
Share on other sites
Quote:
Original post by Sander
Just make sure you use Glade3 and not Glade2. Not sure if Glade3 is already in the Ubuntu repros. If you do use Glade2, make sure you keep the XML formats and use libglade to load them. Don't export your UI to C code!


Yeah it's in there, i'm using it right now :-)

But shouldn't the xml format be equivalent? Is the only difference a version number(implying bugfixes and maybe a few minor features right?) (well other than the fact that glade3 doesn't use the gimp-style multi-window crap)

cheers
-Dan

Share this post


Link to post
Share on other sites
Sign in to follow this