The full title appears to be "GTK4 for Graphical User Interfaces
with the Nim Programming Language", so putting in a reference to Nim in the HN title might be a good idea.
> "GTK4 for Graphical User Interfaces with the Nim Programming Language"
And it is outdated, as there would be no GTK4 - instead it would be released as GTK40, so some API could be changed and samples from this book would not work anymore.
As a supposedly guide to writing app, the introduction reads more like an opinion piece.
The author has a very anti-C stance to say the least. For an article about writing UI, it spends a lot of time laying out all the short-coming of using C to build a UI toolkit.
Amusingly, Qt is mentioned as initially not having a FOSS license but "now available in version 6 with much less restricted licenses"... that's quite a weak praise given that it is available as LGPL, GPL or commercial non FOSS licensing. He then goes on criticizing Qt for being bloated. Most people would rather say that is very feature-rich. Qt is also modular. You don't need to include libraries you don't use.
English does not seems to be the author native language; there are many bad choices of word, like saying that C in "restricted"; I think he meant it is "limited".
> "now available in version 6 with much less restricted licenses"... that's quite a weak praise given that it is available as LGPL, GPL or commercial non FOSS licensing.
I was already writing UI applications with an LGPL licensed Qt 4.x, so the version 6 hasn't changed in that regard, just like version 5 didn't change either. And I'm sure Qt was already FOSS in earlier versions, but 4 and 5 are the ones I can confirm having FOSS licenses.
Qt is fully open source since 2000 and nowadays most of the components are lgpl3. I'm still sad that some people are spreading so much fud about it 20 years later. Same with the bloated thing, people complained that qt and kdelibs were bloated and now that qt and the kde frameworks are modular they complains about too much librairies.
Not fully; only the X11 and embedded version was open source (GPL). The Windows version was only available under a commercial license until 2005. Because of GPL I had to pay for a commercial license for three platforms until 2008. LGPL became available in 2009.
> I'm still sad that some people are spreading so much fud about it 20 years later
It is not exactly the case that the Qt Company clearly points out to users that they can use Qt free of charge under LGPL; rather the opposite seems to be the case. I know various people who primarily bought a commercial licence because they did not consult their own legal advisor and instead followed the recommendations of the QTC sales people.
> I know various people who primarily bought a commercial licence because they did not consult their own legal advisor and instead followed the recommendations of the QTC sales people.
To be fair, if they weren't willing to put in the relatively small amount of effort required to find out how it was licensed, they can clearly affort to pay for the commercial license and if that's true, they probably should do so anyways in order to fund its development.
And yes, I know a very similar argument can be made for horrible dark patterns like the crap TurboTax in the US pulls, but B2B and B2C are very different situations (power imbalance).
> if they weren't willing to put in the relatively small amount of effort required to find out how it was licensed
That's not the point. They are single developers or start-ups not used to match what they intended to develop with the LGPL license terms. Their primary mistake was to trust the sales guys. I had personal contact with some of them, and in no case was a commercial licence objectively necessary. Sure, it's not the only way inexperienced people get ripped off, but it doesn't help confidence and clarity, which is what this thread is about.
Just yesterday I was reviewing Qt, GTK and Electron as possible choices for some GUI exercise, and _at a glance_ Qt sure looks likely to involve committing to GPL, which is a pretty irreversible commitment to have to make at the outset of a project.
I guess it's possible to sort through the individual components and find a subset that is LGPL and not GPL, but that's a lot of work, especially if you're not familiar with Qt already and need to make a decision.
You seem to mix that up with LGPL. With GPL the linked app also becomes GPL. With LGPL this is not the case; usually apps link to Qt dynamic libraries which is ok.
I guess that would work, the time and effort involved in getting end-users to link the application makes downloading a large Electron binary seem downright pleasant.
I realize this is an article about GTK, but the author is really not selling it. It opens with an explanation that GTK is pretty much not maintained. Later, it's compared to Qt:
> The advantage of Qt is that it is active developed and supports all important operating systems including the mobile Android and iOS systems with a native look and feel.
These feel...like important things for your application framework to support. Qt's "bloat" is listed as the only major disadvantage, but only after lamenting GTK's own bloat.
> For many Windows or macOS users GTK has the disadvantage that GTK draws all it widgets itself, it does not use the native graphical elements of the proprietary systems. GTK allows theming by use of cascading style sheets (CSS) so it can be tuned to look not too strange on Windows and macOS, but look and feel generally does not really map to native apps.
Personally, this is one of the worst disadvantages of GTK for me, and makes me cringe when I see an app using GTK's default styling. Even Electron (also lamented for its bloat) does "native" controls by default.
There's really got to be a better argument for using GTK than "it's less bloated and is written in C"
Uh ok. Gtk is maintained and he only said it has few maintainers.
Calling the adwaita theme “cringey” seems silly to me. The latest Mac default style is very similar. Windows “native” look and feel is a joke. A ton of popular apps don’t care about native look anyways they just want their branding.
Qt just tried to pull some crap again with their licensing too.
I appreciate the author because I like nim and gtk development. He even fixed an issue for me last year when I was trying these bindings out.
I don’t agree with his slightly pessimistic view though. There are a lot of new people learning it right now spurred by the new phones and mobile Linux desktop ends.
It’s true the main appeal is to people who like their default styling and the gnome desktop
It's great that the author promotes both Nim and GTK4, which, in my opinion, are both great opensource projects. But I think the author should make it clear that he disabled text anti-aliasing for some reason. A lot of people in this thread are complaining how bad the text rendering is. As someone who uses GNOME (build with GTK) for years, I want to make it clear: GTK supports both anti-aliasing and hinting. The text rendering looks great! It's really just one web search away to check the effects.
> Unfortunately GTK is currently not in a very active state. There seems to be one or two paid full-time developers which try to finish official release 4.0 and a few volunteers which support the development.
Really selling it there. If I'm going to learn a thing the last thing I want to hear is "dead project"
he is not trying to sell/convince you to learn gtk. he is warning if you already want to learn it. not everything posted on hn should be a promotion material.
After working with a wide range of windowing libraries (from raw win32 and x11 to Tkinter, Wx and Qt), I've finally landed on and am staying with qt. It does pretty much everything better than all the other windowing libraries.
I had not looked at Nim before, but certainly will do. If anything, GTK is lacking a bit HOWTOs, which give the beginner a guide, which APIs to use for a certain task. So I will give this a good look. Personally, I have used GTK from Go, which also is a nice match for the API.
I noticed that the mouse cursor is bigger than mine. It could be due to using fractional scaling on a high-DPI monitor, making subpixel artifacts a bit glaring?
I have used GTK several times, but Qt always felt far more pleasant. Plus Qt applications work well on Windows and macOS, whereas GTK renders extremely slowly on macOS and looks and feels very non-native on Windows and macOS.
I think Qt is generally superior. Still, I find GTK easier to get my head around (though I don‘t work regularly with either). Also, as a vanilla Ubuntu user, GTK apps look better on my system.
From the link you provided, it seems Glade is not recommended because there exist better alternatives (in the view of the Gnome project, I can't comment on it).
The alternative is to use... some pen and a paper?
> . If you need to mock something
up, you can try sketching on a piece of paper or using our
mockup resources.
Linux GUI is honestly in a bizarre state. And the Gnome team seems to keeping on recommending against the tools they developed themselves (Vala...). Seems like QT is the best alternative...
This is why I like Qml so much, it is using an declarative ui language while having a nicely organized cpp code for the backend. But as far as I know GTK also have some xml files for the ui.
This is nothing compared to something like the Win32 API.
More importantly, this sort of code is incredibly simple and linear with virtually no logic or state, this is the worst sort of code to try and code golf into something more "elegant", you just end up with something more complicated but less flexible.
The tl;dw: Kernel guys made a scuba diving app, using C + GTK. They switched to C++ and QT, due to issues/poor quality of GTK, bad attitude by GTK. QT also fixed a lot of complaints they had about C++. Also QT looks like native application on other platforms.
I remember using pidgin (then called GAIM) on windows and having it fit right in visually, and that's a GTK2 app. It became slightly more noticeable on Windows 7, where UI animations that were present in the Windows UI would be absent due to, I believe, GTK2 not having a proper animation library, but it still looked like a native app. No idea if that's still the case for GTK3 and onward, though.
Yes, but if you use a 'modern' GTK3 app (take a recent Meld), the absence of the titlebar (or decorated one, if you are into mdern GTK) really stands out. You're right that with some (older?) GTK apps breeze-gtk-theme used to work pretty well, not sure what changed.
It is used, but with a modified titlebar bar the styling on it seems to be ignored. GTK3 apps that leave the titlebar alone are fine (Quidlibet for instance).
It appears that the author had disabled font antialiasing. Any mainstream Linux distro released in the past 10+ (maybe 20) years would have better font rendering by default - but if you wish, you can disable those defaults by changing a few symlinks in /etc/fonts and revert to 1980s style pixelated rendering. Which is ok, some people prefer the retro look.
IMO it looks worse than X11 core rendering because those fonts are often bitmap fonts made to look good without antialiasing whereas just disabling antialiasing in vector fonts often looks too jaggy. Some fonts have good hinting but the vast majority do not bother.
In Windows i also disable antialiasing since i do not like the blurry look but i also force fonts in web sites with good hinting since most sites look horrible with their preferred fonts.
No, it's just the author's configuration. Looks just like the core X11 font rendering of old, but I guess you could configure the modern font rendering system to look just as terrible by turning of anti-aliasing.
Not sure why your comment has been downvoted. I couldn't agree more with you on your finding and the question follows naturally for someone not familiar with Linux desktops.
Others have meanwhile clarified that anti-aliasing wasn't enabled in the examples, which is easy enough to do and is in all production code. Not sure, whether the author had some retro-look effect in mind or just wanted to visually emphasize the examples (he sure succeeded in both).