You are not logged in.
Pages: 1
Hey, i'm currently trying to learn some basic gui programming for linux. I've noticed that i've only seen 2 libraries for guis; qt and gtk. I have a few questions about both:
Is one easier to learn over the other?
Is there any major difference (performance wise) between the 2 languages?
Offline
I find that qt appears to be more well structured which will help your learning, but then I understand C++ better than C. gtkmm (GTK C++ bindings) just seem like a hack. Saying that, the biggest thing I ever wrote was in GTK, mainly because I have a GTK desktop so both are usable...
Overall performance differences are minimal.
Offline
I find gtk+ pretty easy to understand, having had used it in python (and c iirc) ...that is as long as you stay away from gtkTreeModel/gtkTreeView/gtkCellRenderer etc. those are a pain to deal with, but I don't know if Qt is better.
I need a sorted list of all random numbers, so that I can retrieve a suitable one later with a binary search instead of having to iterate through the generation process every time.
Offline
There are more libraries:
*Tcl/Tk
*wxWidgets
*fltk
to only name the "most" popular. Normaly all with many languagebindings. I glimpsed at GTK,QT,wxWidgets (mainly at Pythonbindings) and found that GTK offers some nice Tricks (Smart GUI editor, meta files for independece of any specific language binding.....) and I must admit I hate Slots
{ Github } {Blog and other stuff }
Offline
I'd go for Qt since it can do much more that just make a GUI (think of network or database access). Has some good python bindings (PyQt), it's fast and powerful and pretty straight forward so if there's no special reason to avoid it, I'd say: Qt
Offline
Personally, I like gtkmm over Gtk+. I spent a good part of last week playing with gtk+ and straight c. I got really frustrated with the UI builder stuff. GTK+ tries to be somewhat object oriented, but does so by creating long descriptive function names. I don't often disagree with Allan, but I found Gtkmm to bring harmony to Gtk.
That said, I really like Qt. The licensing is now acceptable for things that are not pure GPL. It works very well for cross platform (Windows) work.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
I've been working with gtk & glade for a couple of years and find them both a nightmare to use.
I find the gtk reference so terse that its of no value and the tutorial positively prehistoric.
Finding examples of how to use particular widgets is a case of trawling deep into masses of blogs and then only finding trivial implimentations.
Everytime I find a widget that is easy to understand and use it gets deprecated in favour of a 'swiss army knife' replacement.
'Real world' examples use so much indirection I have no hope of following them.
Offline
dude, go hardcore and do straight xlib if not i would google around to see which one has the most documentation. If i am correct Qt was professionally developed for awhile which might provide more documentation now thats its opening up. GTK+ has a ubuntu presence and so more noobs playing with it, which means more blog posts on their solutions etc...
Offline
There are more libraries:
*Tcl/Tk
*wxWidgets
*fltkto only name the "most" popular. Normaly all with many languagebindings. I glimpsed at GTK,QT,wxWidgets (mainly at Pythonbindings) and found that GTK offers some nice Tricks (Smart GUI editor, meta files for independece of any specific language binding.....) and I must admit I hate Slots
Tcl/Tk is great, especially if you are starting out programming. It takes very little typing to produce a functioning, useful GUI program in Tcl/Tk.
Offline
I'd make a vote for wxWidgets. It is quite straightforward, and code::blocks makes things nice and easy. It also has good python bindings and is C++ rather than C.
I like it mostly because I used to do a lot of MFC programming years back, and I find that using event tables for event management is quite straightforward.
It is also cross platform, it uses GTK+ on Linux and Native windows widgets on windows, so writing cross platform stuff is a easy and it looks native on both platforms, which QT doesn't, it uses it's own widget libraries.
Offline
Both GTK and Qt are easy enough to learn, and both have very nice Python bindings if you want to go that route.
As for deciding on which one to learn? Well, what DE are you targeting? KDE? Gnome/XFCE/LXDE? It's an easy choice if you already have one in mind.
If you just want to learn "GUI Programming", I'd push strongly for Qt. It has a beautiful object-oriented API, it's own highly integrated IDE, and your apps will look great on Windows too (Mac OS X is also supported). And did I mention the documentation? Simply the best.
Offline
I'm just starting to learn GTK and even though I manage to get things done and the documentation is relatively complete, there's a crucial lack of tutorials and examples. I'm spending a lot of time searching the web and not finding anything of use.
I still want to use GTK because it looks better than Qt and I prefer C to C++ and I'm (obviously) running XFCE.
Offline
Although some of you are now probably going to lynch me, but if you don't have a strict preference for C/C++ (which your initial post didn't state), I would recommend Lazarus (which uses FreePascal). It's design is based on Delphi (which you might have heard about) and is therefore a very good IDE for building user interfaces. It supports QT, GTK2, WinAPI, Carbon and some other backends, which you can "switch" at any time. Want to compile your program for windows? Fine, it will look completely native (actually, it is completely native then ). Want to have specific versions for Gnome/GTK and KDE/QT? No problem.
And no, the underlying language (ObjFPC/Object Pascal) is by no means outdated or can't compete. You have object orientation, generics, etc.
So as I said, if you are open for a "different" language, give it a shot. IMHO the IDE alone is worth it.
Last edited by aksdb (2010-06-13 22:53:48)
Offline
Although some of you are now probably going to lynch me, but if you don't have a strict preference for C/C++ (which your initial post didn't state), I would recommend Lazarus (which uses FreePascal). It's design is based on Delphi (which you might have heard about) and is therefore a very good IDE for building user interfaces. It supports QT, GTK2, WinAPI, Carbon and some other backends, which you can "switch" at any time. Want to compile your program for windows? Fine, it will look completely native (actually, it is completely native then ). Want to have specific versions for Gnome/GTK and KDE/QT? No problem.
And no, the underlying language (ObjFPC/Object Pascal) is by no means outdated or can't compete. You have object orientation, generics, etc.
So as I said, if you are open for a "different" language, give it a shot. IMHO the IDE alone is worth it.
Damn, I used to love Delphi, never seen that though, tempting bloody tempting to play with :S
Offline
Pages: 1