Which way to turn? GTK 3 or 4?

Essentially, my questions are…
Should I abandon Glade and gtk3 for the sake of longevity? What should I use instead of Glade if I go the gtk4 route? Will Builder be useful to me over VSCode?

To add context…
I decided to try to learn coding, for ‘fun’ (!), at the end of the day.

I played around with Python, picked it up very easily and made my own bookkeeping app using tkinter and an sqlite database. But tkinter is ugly and I wanted to make my app seem more ‘proper’!

So I re-wrote my code, and used Glade and gtk 3. For the sake of it, I also tried to follow the GNOME HIG guidance the best I could in case I hit the jackpot and end up with something that could be offered to the GNOME circle (wild fantasy!). On my second (or was it 5th!) re-write I continued to use classes to organise my code when I now know I should have been using modules. I’m now re-writing it again using modules. It’s arduous so this time round I want to do it right!

But before I get too far into it I can’t forget 4 is bigger than 3 and in software terms that means 3 is old and will eventually be deprecated, usually. I don’t know the differences between gtk3 and 4 because I don’t think it matters to my code and app but, should I be re-writing it in gtk4 this time round? Can I re-use my Glade file?

I guess ultimately I want my code to be written correctly, current and up-to-date, and in a way that can be packaged up with flatpak so I can fire it up like an other app. I’m a big fan of GNOME3 and try to go the ‘GNOME way’ as much as possible so I like the idea of Builder except when I’ve give it a test drive I struggle pull away from VSCode. Kudos to MS, it’s really easy and simple.

Thanks for any help. I’ve a dozen questions related to the re-write of my app but gtk3 or 4 should be the first!

Hi, GNOME Circle reviewer here. When we review new apps for inclusion, we require them to use the latest generation of GNOME’s tooling, which consists of GTK4 and libadwaita. Libadwaita provides widgets that let you follow the HIG relatively easily. Thus, I recommend steering towards the newer tooling if you’re not so far into your project that finishing it and then porting would actually be faster and easier.

For GTK4, you can use e.g. Workbench in tandem with the GTK-specific Blueprint language. I also strongly recommend making sure that your project at least can be built from source in GNOME Builder out of the box. Builder has the best Flatpak integration out there, and is really pleasant to work with, but VSCode also has extensions that add Flatpak support.

Good luck with your app!

2 Likes

I’m also writing an app for fun (!?), ahahah. and I’m also using python. My recommendation is to create the project in Gnome Builder, as it creates a basic structure with everything you will need to start developing in Flatpak (which I highly recommend, as it is much easier). Once created, you can open the project in VSCode if you prefer (I prefer).
In VsCode, the flatpak, gtk blueprint, autopep8, flake8 and python extensions.

To design the graphical interface you can use Workbench which will soon have python support, but even without support you can use the general structure.

I also recommend installing the Icon Library app, which contains icons that follow the HIG in svg ready to use.

Thank you for the replies.

I’m busy testing out what’s suggested and how I’m going to go forward.

Python and Workbench sounds great at this stage! Any ideas how long there is to wait? And VSCode… I’m sooo used to it!

It seems a huge, confusing leap going from gtk3, Glade and VSCode to gtk4, Cambalache/Workbench/Bleprint and Builder. I’m struggling with the basics! Not to mention all the alien (to me) files and directories setup by Builder when starting a project. I just had .glade, main.py and my modules previously!

It might feel a little overwhelming, but the files Builder has created are both helpful and necessary if you want to build and distribute your app to a wider audience. What the files are for is documented in the Getting Started tutorial.

See also:
https://toshiocp.github.io/Gtk4-tutorial/

Thank you, guys… going from gtk3/glade to gtk4/xml has been steep for an occasional hobbyist but I’m now there! After 30hrs over 4 days I’m back to adding my old code to the new way! The end result is relief from using glade/cambalache and being able to use xml directly. I now know what those programs were doing and how to get by without them. Thank you!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.