Why Use GTK+?
An anonymous reader writes "IBM DeveloperWorks is running an interesting student article that introduces users to the world of GTK+. It explains what GTK+ is, why you should consider using it, and the benefits it provides. Together with the rest of the series, this installment provides enough introductory information that, if you decide to use GTK+ in your own projects, you'll know where to look for further materials."
Does gimp still use GTK+ of some version or some other for its toolkit?
One interesting consideration when determining what toolkit to go with is that the GUI toolkit for Nokia's new internet tablet is GTK+.
Save your wrists today - switch to Dvorak
GTK+ is a graphical user interface (GUI) tool kit.
Why does yahoo do this
GTK is fine, but as long as it takes a few megabytes to download, only Linux applications will use it. Take a look at The GIMP for example: it is ok to download GTK because it is a big program, but who would develop a small application ( 1MB) if it depends on 6-8 MB for GTK ? On the other hand, Linux users rejoice, as they have good distributions with good dependency resolvers.
It's interesting that they advocate using it vs Win32 in their examples. You really don't have a choice of the overhead for a Win32 system. You do have a choice of ignoring the overhead for GTK+. This overhead is why the POSIX and OS/2 implementations in Windows NT and later were never particularly useful. They used additional overhead (and they translated into Win32 function calls anyways!). GTK+ doesn't have this second problem (as far as I know) but it will still require additional overhead. If that's not a problem, then use it to your hearts content. Otherwise, Win32 seems to be the answer.
a better question might be.. "why use a gui"
For in house stuff I've been on a command line, or straight GLUT kick if I need to display graphics or data in a quick and dirty fashion. Obviously that's not going to work for everything, but you'd be suprised how far it goes.
Are there any cross platform (linux, mac, windows) GUI RAD tools ala Builder, yet?
..don't panic
What the hell is wrong with printf?
to start a Gtk+ vs. Qt Flamewar here. Gtk+ is easier to install & handle (moc can be a real PITA sometimes), but until Gtk+ gets a really GOOD documentation and API, I'll stick with Qt. No, neither google nor devhelp are adequate. I want a reference as well done as the Qt one. Does such a thing exist?
This sig does not contain any SCO code.
No, I'm not kidding: a dialog box with three buttons should be:
D(H:50,W:200){M:"Quit without saving?",B1:"Save"(do_save()),B2:"Don't Save"(no_op&exit()),B3:"Cancel"(drop_quit())};
It doesn't seem to give any information about GTK+ itself, even what the difference between GTK+ and plain GTK is (I am guessing that GTK+ is simply the C++ bindings for GTK).
:).
Basically, I think this introduction is too simplified and high level. I imagine that anyone who ever even considered writing their own GUI code directly above X or raw devices would immediately see the advantage of using a toolkit, and the only questions remaining would be "which one?" and "why GTK+ rather than e.g. GTK or QT?". Possibly it is aimed purely at Windows developers. I remember that several years ago Windows GUI code was a beast to write, and I was amazed at how simple GTK was. If Windows is still that bad, I guess just listing GTK+'s features would be enough to make win32 developer's mouths water, but I'd still prefer the article if it made it clear that win32 is what it is comparing GTK+ to, and did a proper compare and contrast. That way I'd actually have a summary of what Microsoft has been up to in the last decade
Are there any cross platform (linux, mac, windows) GUI RAD tools ala Builder, yet?
Yes -- wxDesigner is a very nice RAD for use with the wxWidgets GUI-building environment. wxWidgets is a cross-platform GUI framework which uses native widgets. On Linux, it uses GTK+. On Windows, it uses Windows widgets. On Mac, it uses Mac widgets. There are other somewhat-supported platforms. This approach contrasts with that of the Qt framework -- another cross-platform builder (which is excellent), which implements all its own widgets on each platform. Also unlike Qt, wxWidgets is not bound by the GPL -- you're pretty much free to do as you like with it (i.e. incorporating it into commercial apps, without the requirement that you release your source code, or pay any licensing fee). wxDesigner is a very nice GUI RAD builder for wxWidgets. It's not free, but it's cheap. You definitely get your money's worth.
Also it would be one less function that has to be written and maintained across the thousands of projects that use GTK.
> GTK+ is a graphical user interface (GUI) tool kit.
And all this time I thought everyone was talking about a game called "Grand Theft Potassium Ion".
Sheesh, evil *and* a jerk. -- Jade
True, wxDesigner is an alternative on Linux I haven't thought of. Thanks :-)
2 263&cid=14343999
BTW see http://developers.slashdot.org/comments.pl?sid=17
See http://wyoguide.sf.net/papers/Cross-platform.html
No, the current stable win32 GTK+ runtime is 3.5 MB. Here's the download page.
Hey u all forgot wxWindow. That's strange. I think it is a strong competitor of GTK+ and Qt. Isn't it
Why not wxWidgets? It's more flexible if you ask me. It simply wraps the native GUI stuff, or an other toolkit like GTK+.
I don't have any numbers, but I think the performance would be better and the distribution size shouldn't suffer much (as with Qt or GTK+).
IBM seems to skip over one of the biggest reasons to NOT use GTK+ - it just doesn't look right on Windows. I'm not sure who said it but a commentator suggested a while ago that one of the reasons open-source programs weren't overtaking closed source was due to a lack of polish (which does of course cover more than just appearance); he used GAIM vs. MSN Messenger as an example. The jarring difference between controls in GTK+ or Java or even Mozilla to some extent vs Win32 is important when you're creating an application for normal end users. In my opinion, that difference can look unprofessional. I would figure that the issue of appearance could be mitigated but it hasn't yet so I don't know for sure.
A question for someone who knows more about GUI toolkits: What are the issues involved in matching the appearance between toolkit controls and the native controls?
(I find it hilarious that I was marked offtopic for pointing out that the original story was offtopic. I stand by that comment regardless of how it's modded, though.)
Okay, you're undoubtedly right. (By the way, I maintain a Perl-Gtk module, so I don't mean to knock on Gtk. It's simple to use, and importantly for me the Perl-Gtk community is very active.)
I'm not sure though for example why you couldn't implement a word processor in AJAX. Or, using SVG, you could do something with 3-d modeling? I guess it would depend on the features. A grammar checker might be hard to write in JavaScript, for example... Then again, you might be able to send the text to the server to do something like that. (I think the distributed computing dream has never seemed to materialize. That's the context in which I see "AJAX" being really powerful, though. I imagine having a web service (use JSON instead of SOAP, if you want) running on a server dedicated to grammar checking. You might whine about network latency, but then again you never had to download (or even load into memory) the grammar checker, and it could be optimized on the server end (in practice, it'd no doubt be hammered all the time, though, which along with security concerns is probably a big reason why distributed computing has been a pipe dream).)
But your point is that not every application can be done using AJAX. Okay, granted. But maybe a generic XUL-like framework? Why isn't something like Gtk exposed through Mozilla, then? (Maybe it is. I think you can write custom widgets, expose them using...XBL or XPCONNECT or whatever it is.) The browser itself is done with Gtk. So a browser can be implemented in Gtk, and using XUL we can create fairly sophisticated GUI applications (browser, mailer, calendar). I wouldn't be surprised if in fact you couldn't implement a word processor in XUL. So my argument has drifted from AJAX to XUL. But XUL and AJAX are similar in ways, just different focuses. Another dream that hasn't seemed to have lived up to its initial promise, XUL. Now this comment does deserve to be modded offtopic. Thanks.
No one distributes software on floppies any more. 6-8MB added to your installer isn't a BIG deal. It translates into another 30sec worth of download. If its a burden on anyone, it's a burden on your webservers.
I think you meant to say it IS a big deal, since it translates to 30 MINUTES of extra download time on a dial-up line, which unfortunately most users are still stuck with. Even broadband lines aren't all 1.5Mb/s.
In many industries, this is the preferred method. I know our company increasingly is offered (and purchases) laboratory information management systems (LIMS) and curated databases with various front-ends that are Java apps.
.Net holds some promise here. It won't be useful in our industry until it's well-supported outside Windows, but I imagine that there's other industries that still have less heterogeneous environments...
Comment as you will, they have actually proven to perfom exceptionally well and been quite resilient and easy to install across a variety of platforms (like most in our industry, we have a combination of Windows, Mac OSX, and Linux desktops with Solaris, Irix, and HP/UX servers).
For things like Linux, the ability to treat jar-files as native executables (using the binfmt-misc mechanism) makes it dead-simple to deploy apps.
This is not entirely unique to Java.
I whole-heartedly favor cross-platform VMs to whatever extent they are appropriate and I really don't buy the "jarring difference in appearance" argument. Clipboard interoperability, maybe; hosting native media widgets, sure, but button textures? Dumb.
One issue that I like to look at when I'm thinking about GUI toolkits is the question of what programming languages does it support.
I often need to rapidly prototype a graphical UI, and one that's not just a standard set of static attributes. I find that for these cases the graphical layout tools fall down pretty quickly, and I'm back to writing code to make the UI.
Now, if I'm going to be writing code for GUI prototypes, I want code that I can write, test, and show off fast. I don't want to start a language war, but to me that says "not C++."
So a big question for me is "what other languages does your toolkit support easily?" Is there a good perl interface? python? scheme? What can I use to lash it together quickly?
For this kind of thing, sadly enough, it seems like the venerable Tcl + Tk combination is still hard to beat.
And when you need an alternative language APIs, we need documentation that is native to those languages. All too many of these toolkits provide some rudimentary alternative UI, but it's just an export of the C++ API, and the programmer is expected to read the C++ documentation, and mentally convert that to the appropriate perl, python or what-have-you alternative.
So what are the easy cross-platform, scripting UI alternatives? Tcl + Tk, python + wxWidgets, and what else? Any way to get at those Swing libraries without heavy lifting with Java?
I haven't read the article, since GTK+ is already my preferred GUI toolkit. And this in spite of the fact that I run KDE as my primary desktop! I run both Gnome and KDE, and my choice of KDE over Gnome is based more on organization and flexibility than it is on the underlying GUI toolkit.
As background: My wrote my first GUI programs back in the days of Window 3.1, and while most of my work is on data-crunching engines, I do write quite a few GUI applications. I need to rapidly generate an interface, back it with code, and have it presentable on Windows and Linux.
As a programmer, I don't like QT. It feels klunky, bloated; nor do I find QT Designer all that friendly. Beyond matters of taste and comfort, TrollTech requires a commercial license for certain tools (e.g., a MathML widget) that I can obtain under GPL for GTK+.
I'm rather fond of Glade. Most of my GTK+ GUI programs are in C, some in C++; I define an interface in Glade, fill in the appropriate functions, and I'm ready to rock and roll.
GTK+ 2.8 brought with it Cairo, a very nice drawing toolkit. I just put together a little interactive graphics application, just to better familiarize myself with Cairo, and the result is quite nice.
In the near future, I'll be writing some very extensive OpenGL applications, and I'll likely wrap these in a GTK+ GUI. If something better comes along, I'll try it -- but for now, GTK+ provides what I need. Your mileage may vary.
All about me
I like GTK and use it both with C and with python (pygtk).
I also used other toolkits, like tk, wxwindows, QT, java swing.
I like the native C API + language bindings for every taste, so I can
program GTK at the abstraction level I want. I like the pango markup. Also interface prototyping is fast enough (though not as fast as with tk) [...]
Among the few things I do _not_ like are the new GtkTreeView, which is very general and powerful, but it makes doing very simple things too complicated, and the terrible new gtkFileChooserDialog.
However, I can still avoid those using some deprecated widgets (for now).
> How does GTK+ compare to Tk and and WxWidgets?
GTK is more powerful (you can tweak widgets more), but it's bigger and more painful to program. You can do the most complicated things, but easy things are longer to achieve. To the random user, a well built GTK interface looks decent.
With Tk you have a much simpler API, where the common operations are much easier to perform. However some things you can do in GTK are almost impossibile to perform on tk (things the average programmer seldom needs though). To the random user, tk looks horrible. To me it looks perfectly ok, so I really do not understand what hurts people's eyes.
I have played with wxWidgets, but I leave the comparison to someone else.
Badly written Tk looks horribly Motif like and dated. Good Tk (with theming thanks to the tile project http://tktable.sourceforge.net/tile/ ) can look quite nice an modern, take a look at the screenshots. Its just the little extra polish thats often missing in Tk apps, because the authors are adding features instead of polishing the GUI.
- A steering wheel for ease of navigation!
- Four wheels providing good stability, even while turning!
- Car seats, so you don't fall though the floor!
- There is even a vibrant community of fuel stations than can refuel your Ferrari!!!
Yet another slashdot article referring to a product without explaining the purpose of said product.
GTK+ is a toolkit for GIMP.
GIMP is an open sourced graphics manipulation package (think Photoshop but free as in speech and beer).
I am government man, come from the government. The government has sent me. -- G.I.R.