from Hacker News

GTK4 for Graphical User Interfaces

by chauhankiran on 1/3/21, 1:41 PM with 75 comments

  • by hmry on 1/3/21, 2:24 PM

    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.
  • by pierrebai on 1/3/21, 3:11 PM

    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".

  • by bastawhiz on 1/3/21, 10:16 PM

    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"

  • by longstation on 1/3/21, 5:39 PM

    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.
  • by overgard on 1/3/21, 3:56 PM

    > 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"

  • by dekhn on 1/3/21, 4:31 PM

    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.
  • by _ph_ on 1/3/21, 2:22 PM

    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.
  • by macmac on 1/3/21, 2:35 PM

    The text rendering seems very poor. Is that an artefact of the font used, the platform or something else?
  • by unwind on 1/3/21, 2:18 PM

    Oh, did they drop the "+"? The name used to be "GTK+" but that seems to have changed. Does anyone know when?
  • by benbristow on 1/3/21, 3:11 PM

    Can't help but think a lot of code is needed here just to render some controls on a window.

    Something like XAML for GTK would be nice.

  • by mseidl on 1/3/21, 2:44 PM

    #qt4ever

    https://www.youtube.com/watch?v=gGZyVSOnqm0

    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.

  • by wcchandler on 1/3/21, 4:07 PM

    The author talks about how android doesn’t use GTK. What does Android use? Some kind of Java thing?
  • by chrisseaton on 1/3/21, 4:40 PM

    Wow the text rendering is atrocious. Is this still the state of GTK and desktop Linux today?
  • by ku-man on 1/3/21, 2:13 PM

    Title should be: GTK4 for Graphical User Interfaces with Nim