mring
mring

Reputation: 1747

Should a person new to windowed applications study X, GTK+, or what?

Let's say the factors for valuing a choice are the library of widgets available, the slope of the learning curve, and the degree of portability (platforms it works on). As far a language binding goes, I'm using C++.

Thanks!

Upvotes: 4

Views: 490

Answers (11)

Thomas Matthews
Thomas Matthews

Reputation: 57728

I suggest getting a generic book on GUIs. I have used Borland's, Windows, wxWidgets, QT, and PEG windowing frameworks. In summary, there is no standard, but GUI systems are Event Driven. Study up on Event Driven programming and that should give you an excellent foundation.

Upvotes: 1

n0rd
n0rd

Reputation: 12670

Qt is very good. It has quite large library (not UI only). Runs on a lot of platforms.

Upvotes: 11

avpaderno
avpaderno

Reputation: 29699

As you requested a widget library for C++, then I would suggest QT, which was created for that programming language; GTK is good too, but it was created for C (as many of the libraries created for the GNU project which privileges C against C++).
Nobody uses X directly while creating an application; the only people who work directly with X is who is creating a new widget library, as already reported from other people here.

Upvotes: 3

BlackAura
BlackAura

Reputation: 3208

Unless you're planning to write your own UI toolkit, there's really no point in using X directly anymore. Too hard, too much work.

On Linux, you have the two main choices - GTK and Qt. Both work fine. Qt works better as a native C++ toolkit than GTK itself, although GTKmm is a decent C++ wrapper for it. GTK tends to be usable from more languages than Qt, but that doesn't matter if you're using C++ anyway.

Both are cross-platform, but GTK feels somewhat alien on other operating systems, particularly on Mac OS X. Qt feels completely native on Windows, and fairly close on Mac OS X. It also provides a lot of other cross-platform functionality beyond the UI, such as threading, filesystem access, networking, and so on. Qt certainly seems to win on the portability front, at least.

Generally, go with something that's popular - there's more chance of finding good examples, pre-made applications you can dissect, libraries you can use, or even just finding help here.

Upvotes: 3

lorenzog
lorenzog

Reputation: 3609

I think there is another issue that you did not mention: where do you want to go with it?

  • do you want to "just learn it" or do you have a specific application in mind?
  • if you have an application, perhaps you also need to consider:
    • what OS you plan to run it on
    • how is the community supporting it: active? is it difficult to get help?
  • what performance do you need/expect?
  • how long do you plan to support it? (you might decide to run^H^H^Hmove away from C++ in a few years, and if so, would it make sense to use a different language - ie Java?)

Upvotes: 0

mch
mch

Reputation: 7393

If you are most familiar with an interested in C, GTK+ is a good place to start. If C++, QT is probably a better choice. Your desktop of choice is also a factor. Gnome uses GTK+, KDE uses QT.

Raw X programming is much to low-level to start with. Very few programs are written directly against the X API directly. There have always been toolkits layered over it. Some of the older toolkits are Motif (Lesstif) and Athena. Don't try to start with those though, they are very old now.

Upvotes: 0

PierreBdR
PierreBdR

Reputation: 43294

In my opinion, the best C++ GUI toolkit is Qt http://qt.nokia.com

It's cross-plateform (windows, mac os x, linux), efficient and has quite a few nice extensions (Qwt, Qwt3d, QGLViewer, ...)

On the other hand, if you want to learn about GUI programming, I would learn quite a few systems, including GTK, Tk, Motif.

Upvotes: 1

Upul Bandara
Upul Bandara

Reputation: 5958

I think you can start with wxWidgets.

Upvotes: 0

Pure X is quite hardcore these days, and not very portable. Basically, there are three major toolkits:

  • GTK+ (and C++ wrapper GTKmm)
  • Qt
  • wxWidgets

which are pretty comparable, so which to choose is a matter of taste. All three run on major three operating systems, although GTK+ on Mac and Windows is little bit awkward.

Upvotes: 11

balpha
balpha

Reputation: 50948

My personal favorite: Qt. It's cross-platform, it's very intuitive, it's extensively documented, there's bindings for many languages (the original is C++), and it's actually fun to develop with it.

Upvotes: 8

jldupont
jldupont

Reputation: 96806

GTK+ it is: runs on most Linux distros and Windows too.

Of course there are also Qt and WxWidgets which are cross-platform.

Upvotes: 1

Related Questions