Linked by Eugenia Loli-Queru on Wed 11th Jan 2006 23:23 UTC
GTK+ This article, the second in a three-part series titled "GTK+ fundamentals," introduces you to programming with GTK+. It analyzes a sample GTK+ application written in C, then shows that same application written in Python and C#. Finally, it discusses some useful tools that can help you develop better applications faster with GTK+.
Order by: Score:
Time
by klynch (1.64) on Thu 12th Jan 2006 00:00 UTC
klynch
Member since:
2005-07-06
Fans: 0

I've always wanted to learn some GUI programming with GTK+. I've just never had the time to. Maybe reading this will spark my motivation.

Another decent (and more extensive) tutorial for using GTK+-2.0 can be found on GTK's own site at http://www.gtk.org/tutorial/

RE: Time
by mcrbids (1.17) on Fri 13th Jan 2006 10:37 UTC in reply to "Time"
mcrbids Member since:
2005-10-25
Fans: 0

If you want to learn GTK+ programming, and want to make it as easy as possible, you might consider http://gtk.php.net/ PHP-GTK.

I've used PHP 4/GTK 1.3 to write a large (80,000 line) application used to generate compliance paperwork for schools. It works well, and I can often edit the source code to a *running* program and see the result right away.

To hide the sources in distribution, I use ioncube encoder.

v Question for GTK developers
by Tom K (2.28) on Thu 12th Jan 2006 00:33 UTC
RE: Question for GTK developers
by Unbeliever (1.56) on Thu 12th Jan 2006 00:38 UTC in reply to "Question for GTK developers"
Unbeliever Member since:
2005-07-09
Fans: 0

Becuase they're using a different toolkit. Now, let me ask you this, why do Apple apps look so out-of-place in Windows? With their Aqua scrollbars, and all.

RE[2]: Question for GTK developers
by Tom K (2.28) on Thu 12th Jan 2006 00:45 UTC in reply to "RE: Question for GTK developers"
Tom K Member since:
2005-07-06
Fans: 9

Hmm ... did I mention Apple? No, I'm pretty sure I didn't.

Anyway, using a different toolkit is no excuse. QT Windows apps look fine. So again, why do GTK apps look so out-of-place?

RE[3]: Question for GTK developers
by Eugenia (Staff) on Thu 12th Jan 2006 00:50 UTC in reply to "RE[2]: Question for GTK developers"
Eugenia Member since:
2005-06-28
Fans: 15

Because GTK+ is a toolkit on its own, it does not use the Windows toolkit in any way to get the look copied (similar to what toolkits do on OSX, where they can use the "Appearance Manager" API). wxWidgets and Qt do that on both Windows and OSX and so they feel more native. GTK has chosen not to do so and relies on the abilities of a Windows-like theme to make the look similar to Windows'. But a flat out answer to your troll-baiting question is: it was a design decision from Day 1. And it was probably easier to implement it this way.

RE[4]: Question for GTK developers
by Tom K (2.28) on Thu 12th Jan 2006 01:16 UTC in reply to "RE[3]: Question for GTK developers"
Tom K Member since:
2005-07-06
Fans: 9

Easier? So what? Are the GTK devs lazy?

If it means the difference between a decent toolkit that looks good in an OS used on 90% of the world's desktop computers, and a decent toolkit that looks out of place and causes some people to choose not to use GTK-based apps because of their appearance, then the choice is obvious.

RE[4]: Question for GTK developers
by zerblat (2.28) on Thu 12th Jan 2006 01:32 UTC in reply to "RE[3]: Question for GTK developers"
zerblat Member since:
2005-07-06
Fans: 0

If I understand correctly, Qt doesn't actually use Windows widgets, it uses XP's style engine to draw the widgets ( http://doc.trolltech.com/4.0/qwindowsxpstyle.html#details ), which gives them a native look that follows the theme etc. That is, assuming you are using Qt's XP theme.

But AFAICT, the same is true for GTK if you use GTK-Wimp ( http://gtk-wimp.sourceforge.net ).

So, is there a technical difference between what the Windows XP theme for Qt does and what GTK-Wimp does?

RE[4]: Question for GTK developers
by segedunum (2.92) on Thu 12th Jan 2006 12:58 UTC in reply to "RE[3]: Question for GTK developers"
segedunum Member since:
2005-07-06
Fans: 22

wxWidgets and Qt do that on both Windows and OSX and so they feel more native.

Qt does emulation which strikes a balance between native look and feel and maintainability, with the extremely complex differences you can get between supporting each platform natively. SWT has a lot of experience with this.

But a flat out answer to your troll-baiting question is: it was a design decision from Day 1. And it was probably easier to implement it this way.

That's a bit of a problem for a cross-platform toolkit, isn't it?

RE[3]: Question for GTK developers
by netdur (2.12) on Thu 12th Jan 2006 00:51 UTC in reply to "RE[2]: Question for GTK developers"
netdur Member since:
2005-07-07
Fans: 0

it's about theme not the code!

RE[4]: Question for GTK developers
by Eugenia (Staff) on Thu 12th Jan 2006 00:54 UTC in reply to "RE[3]: Question for GTK developers"
Eugenia Member since:
2005-06-28
Fans: 15

>it's about theme not the code!

You are wrong. It is about the code. GTK does not use Windows' widgets directly like other ported toolkits do. It was easier for the developers to do it this way. A theme can only help the situation so much.

RE[3]: Question for GTK developers
by Unbeliever (1.56) on Thu 12th Jan 2006 00:52 UTC in reply to "RE[2]: Question for GTK developers"
Unbeliever Member since:
2005-07-09
Fans: 0

You don't have to mention Apple. It was an example to counter your little theory that only GTK+ apps look out-of-place in Windows.

Every app looks out of place in Windows, Microsoft apps included (hint: WMP). QT apps look out of place as well, you just don't take into account the fact that design-wise, KDE apps (which use Qt) are much closer to Windows than GNOME is.

RE[4]: Question for GTK developers
by Tom K (2.28) on Thu 12th Jan 2006 01:19 UTC in reply to "RE[3]: Question for GTK developers"
Tom K Member since:
2005-07-06
Fans: 9

Whoa whoa, don't put words in my mouth. I didn't say that ONLY GTK apps look out-of-place. That was your assumption.

And no, every app does not look out of place on Windows. Apple apps are even designed to look like Windows Luna/Classic, so that's a moot point. Microsoft's poor consistency with regards to Office/Media Player are something that I wish was corrected, but you can't have everything.

GTK apps, on the other hand, DO attempt to look like Windows, but do it poorly.

RE[3]: Question for GTK developers
by t3RRa (2.24) on Thu 12th Jan 2006 01:22 UTC in reply to "RE[2]: Question for GTK developers"
t3RRa Member since:
2005-11-22
Fans: 1

Have you ever looked at yourself at all? Please look at the mirror now! You will finally notice ... that.. actually... you are the poo itself! You look so out-of-place among us. Why is that? Do troll NO MORE. It makes you not-respectful/worthless person in this society.


Back to the topic, It seems the programming in GTK+ easier than I thought after quick look at the article. However, for this kind of development, I feel like OOP makes much more sense than non-OOP.

RE[4]: Question for GTK developers
by Daniel Borgmann (3.68) on Thu 12th Jan 2006 01:32 UTC in reply to "RE[3]: Question for GTK developers"
Daniel Borgmann Member since:
2005-07-08
Fans: 2

Back to the topic, It seems the programming in GTK+ easier than I thought after quick look at the article. However, for this kind of development, I feel like OOP makes much more sense than non-OOP.

It is OOP, the C-syntax just makes it look awkward. As the article shows, you can easily use Gtk with an object oriented language like Python or C# (and C++ of course).

RE: Question for GTK developers
by betson (2.48) on Thu 12th Jan 2006 00:55 UTC in reply to "Question for GTK developers"
betson Member since:
2005-12-17
Fans: 1

Because they neglected to deliever the WIMP theme with their GTK+ runtimes.

Once that's been accomplished, GTK+ apps don't look out of place on Windows--they only *feel* out of place.

uh
by gplCop318 (1.2) on Thu 12th Jan 2006 01:22 UTC
gplCop318
Member since:
2006-01-10
Fans: 0

i like GTK on linux or win... better than java and that ugly stuff....

uh
by gplCop318 (1.2) on Thu 12th Jan 2006 03:20 UTC
gplCop318
Member since:
2006-01-10
Fans: 0

well QT still has some licensing issues on windows and I had a lot of problem getting it setup and working along with pyQT due to the different versions... There is a unofficial FREE winQT port and and a official NC (non commercial) port but none seem to like the pyQT I was trying to use to build some pyQT apps...

I find gtk to be simple and have no problems on either platform...

RE: uh
by BryanFeeney (3.64) on Thu 12th Jan 2006 10:08 UTC in reply to "uh"
BryanFeeney Member since:
2005-07-06
Fans: 0

A GPL version of Qt4 is available for every platform (including Windows) at this page: http://www.trolltech.com/download/opensource.html

If the GPL isn't good enough, then you have to pay. But it should be good enough for open-source, and if you don't want to write open-source (e.g. you want your users to pay) I don't see why you shouldn't expect to pay yourself.

PyQt hasn't caught up with Qt4 yet, but when it does no-one will have any troubles. Until then, you can still use C++.

Personally I find Qt to be a lot easier than GTK. It's important not to confuse "licensing issues" with actual development.

RE[2]: uh
by gplCop318 (1.2) on Thu 12th Jan 2006 17:04 UTC in reply to "RE: uh"
gplCop318 Member since:
2006-01-10
Fans: 0

yea i think I mentioned that....
So you do a lot of QT and in particular pyQT developing on windows and have no troubles?
Please give me a step by step of your setup and let me know which python you use, which QT and which pyQT I would be very interested. When I do it my QT NC version always looks for the NC pyQT matchign version or some such and then it seems to overlook my python2.4 install and so forth...
Oh, I am mostly just trying to get some apps compiled and am having lots of problems...in fact I gave up! ;)

Get real
by buff (3.28) on Thu 12th Jan 2006 03:42 UTC
buff
Member since:
2005-11-12
Fans: 1

Come on get real. GTK apps don't stick out that much in Windows. I installed Gimp2 on all our labs windows xp boxes and nobody has said anything about how it looks. They are just happy to be able to edit their photos for free. Not everything has to have gel buttons on it or brushed metal to make it work well.

Edited 2006-01-12 03:43

RE: Get real
by Wrawrat (2.88) on Thu 12th Jan 2006 05:14 UTC in reply to "Get real"
Wrawrat Member since:
2005-06-30
Fans: 1

For the look, yeah. WIMP does a great job. As for the feel... For example, the Save dialog is completely foreign. The redraw speed isn't typical of the other applications, either.

Of course, it doesn't remove its merits nor its usefulness. The possibility of using a powerful application for manipulating your pictures at no charge is nothing to sneeze at. Still, it doesn't feel completely at home. That said, it would probably need a new UI just for Windows and I don't believe the port maintainers are interested...

RE: Get real
by Lumbergh (1.68) on Thu 12th Jan 2006 05:27 UTC in reply to "Get real"
Lumbergh Member since:
2005-06-29
Fans: 1

Agreed. With the WMP theme, gtk+ on windows looks pretty good. At least it uses native fonts, unlike the still butt-ugly Swing.

RE[2]: Get real
by chemical_scum (2.72) on Fri 13th Jan 2006 02:50 UTC in reply to "RE: Get real"
chemical_scum Member since:
2005-11-02
Fans: 3

Agreed. With the WMP theme, gtk+ on windows looks pretty good. At least it uses native fonts, unlike the still butt-ugly Swing.

Yeah - though in the win port of Gnumeric you can choose if you want the WMP or GTK theme, I prefer it with the GTK look. But I guess that's the way I am used to seeing it.

The Swing fonts look worst on Linux/GTK especially with that disgusting parody of a GTK theme (I switch it back to metal if I can). Thank god for SWT, it gets the fonts right on both Windows and GTK and looks nice on both.

opposite end of the equation.... usually
by re_re (3.88) on Thu 12th Jan 2006 08:07 UTC
re_re
Member since:
2005-07-06
Fans: 0

well poo, more often then not I disagree with you, however on this issue, I do agree with you, gtk apps look horrable in windows, I've run gaim and gimp in windows in the past and it looks nasty, I don't care because I haven't run Windows in quite some time on any of my machines but most people do run windows and they do care.

I'll be honest, I tend to lean towards qt for a lot of things but this is not why I say these things about gtk, I try to be very objective, and from my point of view gtk does not fit well into the windows api.

RE[2]: uh
by Morty (4.16) on Thu 12th Jan 2006 10:35 UTC
Morty
Member since:
2005-07-06
Fans: 4

PyQt hasn't caught up with Qt4 yet, but when it does no-one will have any troubles. Until then, you can still use C++.

But it's getting there, while I was reading your post this message appeared on the PyQt mailinglist:-)

"You can find a binary package of a current snapshot of PyQt4 GPL for Windows
at http://www.riverbankcomputing.com/Downloads/PyQt4/"

Win consistency
by miro (2.24) on Thu 12th Jan 2006 13:37 UTC
miro
Member since:
2005-07-13
Fans: 0

Ah common, and look closer, notepad, winrar, winzip, powerarchiver, office, outlook look definitely not the same. Each of these apps have different toolbars, different size of icons, different menus, some are flat some are more 3D. On my win2000 machine, some apps have xp style menus, some don't, some apps use the File, Edit, View .. Help menu system some don't. Sometimes the difference between a VC app and a delphi app is far greater then notepad <-> gtk / Qt app.

I think that the bigger problem here is not how apps LOOK like but that they all WORK in a different way. Most gtk+ programs have a connection to gnome, which WORKS a *little* different than windows.

RE: Win consistency
by Ookaze (2.8) on Thu 12th Jan 2006 15:19 UTC in reply to "Win consistency"
Ookaze Member since:
2005-11-14
Fans: 2

You forgot the apps that have colored icons by default, and those that appear gray and are colored when you point your mouse other them. There are so much examples.
Windows users that talk about inconsistency in other OS than Windows are zealots : the pot that call the kettle black. Everyone of them with some sense admit it, even on this thread, but they are quick to find excuses and dismiss what they found so important seconds before : talk about hypocrisis.
Currently, I have to use 2 Windows OS at work (NT4 and XP SP2), and you can bet no app look the same, and I have Wordpad, Outlook, Firefox and Explorer opened !!! Fonts are different, widgets are different, behaviour is different, size and design of icons are different, ... And they dare talk about consistency !! On the XP SP2 it's even worse.

I think that the bigger problem here is not how apps LOOK like but that they all WORK in a different way. Most gtk+ programs have a connection to gnome, which WORKS a *little* different than windows

The major problem is Windows zealots actually.
You say Gnome works a little different than Windows, I say it works a LOT different.
Gnome apps are consistent, Gnome apps are integrated, Gnome apps work right (well sort of), Windows apps don't.
There still are basic things that don't work on Windows : the application bar (which for example, shrinks itself at each reboot when in vertical position, or does not disappear automatically sometimes), the multi file selection (order still wrong when you paste), the install/remove that does not work, ... The inconsistent things have been listed already.
I have other examples of how Gnome works a lot different : simple click is usable, files copied have their size updated in real time, theme is consistent not per app, session works, input methods are consistent, virtual desktops works, multisession exists and is powerful, email clients never infect you, ...
Windows power users should stop these Windows zealots that give a bad reputation to their OS (there I said it).
These complaints were true, but as soon as Gnome 2.0 came out (with pango, gobject, gconf, gnome-vfs, ...) to address all of these, the complaints should have stopped, cause at least Gnome devs tried to do sth about these problems. MS did not do that for Windows till then, but you never hear a complaint from the zealot.

Looks and feel
by Tweek (1.6) on Thu 12th Jan 2006 16:05 UTC
Tweek
Member since:
2006-01-12
Fans: 0

I would like to point out that the average user just flat out doesnt care if an application looks different.

Take Limewire for instance. I have asked MANY people if the different color scheme and controls bother them and most people didnt even pay attention/notice it till i brought it up. THe rest simply didnt care.

If the app is easy to use, the look and feel (at the trivial color scheme and button style) is absolutely the lease important factor for the average user.

Basically when these discussion arise it just shows that the average geek is long out of touch with the average USER.

RE: Looks and feel
by Ookaze (2.8) on Thu 12th Jan 2006 16:32 UTC in reply to "Looks and feel"
Ookaze Member since:
2005-11-14
Fans: 2

I would like to point out that the average user just flat out doesnt care if an application looks different

That's my experience too. Actually, I never saw a user complain about that, except Windows zealots of course.

If the app is easy to use, the look and feel is absolutely the lease important factor for the average user

I'd go as far as saying even if the app is not easy to use, people will use the app without complaining, especially if that's all they know about/can afford. I used to do fansubs on Windows, and had to battle through a lot of hard to use apps and the crappy OS to get something done, but I never complained about inconsistency, I was at least getting work done, and that's what count.

Basically when these discussion arise it just shows that the average geek is long out of touch with the average USER

I don't think so, I think Windows zealots are out of touch. It has been showed time and again that geeks don't mind these things. Gnome 1.0 was heavily criticised as a geek desktop because of that.

RE: Looks and feel
by Emerson (1.64) on Thu 12th Jan 2006 18:45 UTC in reply to "Looks and feel"
Emerson Member since:
2005-09-19
Fans: 0

"I would like to point out that the average user just flat out doesnt care if an application looks different."

I'd agree, but make an exception for the gimp. Aside from the internet, I've never met a person who didn't have to overcome an initial revulsion at its gui. I'm not trying to overstate the case either. Most artists I've shown it too really were right next to the point of cringing when I showed it to them.

Not really trying to put down the gimp, so much as just state amazement at how a single program can break so many expectations.

But wait there's more
by Sphinx (2.84) on Thu 12th Jan 2006 17:41 UTC
Sphinx
Member since:
2005-07-09
Fans: 12

The gtkembedded object from Mozilla gives your gtk program the most 3wc compliant browser there is for you to easily hook to your hardware events, a whole big can of whoop-ass for embedded linux. I easily created browser javascript function hooks for a mag card reader and bar code scanner with it, endless possibilities available. GTK+ rocks.