[SOLVED] Which one to use for Desktop Applications: Python with GTK or C++ with QT?

About programming and getting involved with Linux Mint development
Forum rules
Topics in this forum are automatically closed 6 months after creation.
mudassir
Level 3
Level 3
Posts: 118
Joined: Tue Dec 12, 2023 2:28 am

[SOLVED] Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by mudassir »

Hi, I migrated from Windows world and used to make database applications for web in Php + MySQL and for desktop in VB and Visual FoxPro for clients. I am good with Php + MySQL but dealing with desktop projects seems frustrating.

Most of my projects are written in Visual FoxPro as I've been working from the time of D Base III Plus or FoxPro for DOS. Now on Linux, I've to access those tools via Wine and I want to switch to some native programming language (or should I say a language which can compile standalone applications for both Linux and Windows).

I neither used Python nor C++ (just in school, which I barely remember). Database should not be a problem as both the languages support SQLite. I seek guidance from experienced coders about choosing a language to accomplish my tasks:

* Please don't advice which tool you use in school or for fun learning.

Should it be Python with GTK or C++ with QT?
Which language is easier to generate printable reports with different fonts, sizes and alignment (bills / statements / ledger etc.)?
Which is the best RAD GUI framework to use? Something like drag widgets / controls to the window, set properties, write code for events, call functions / procedures and compile?
Last edited by mudassir on Sat Feb 10, 2024 7:38 pm, edited 1 time in total.
Please SHARE Knowledge.. Let's not FLAUNT it...
FUN := 'Linux Mint 21 Vanessa Cinnamon' + 'Php, Apache, MySQL Server' + 'Lazarus' + 'Gambas';
const Lazarus : Pascal; const Gambas As BASIC
User avatar
Valsodar
Level 4
Level 4
Posts: 364
Joined: Thu Jul 19, 2018 11:30 pm
Location: Sofia, Bulgaria
Contact:

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by Valsodar »

Speaking strictly out of user experience: QT sucks a lot! Better aim for GTK, if you're gonna make applications.
Core i7-4770, Palit GTX 1660 Ti, 32GB DDR3 RAM, Firefox, Arch LTS w/ Cinnamon 5.2.7
My Linux group on Telegram
Avatar & desktop: https://ibb.co/album/GFx0yV
billyswong
Level 8
Level 8
Posts: 2239
Joined: Wed Aug 14, 2019 1:02 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by billyswong »

My own personal experience in RAD GUI framework for cross-platform is Lazarus, a very VB-like experience with Pascal code underneath, and generate extremely portable executable by default.

"Python with GTK" is where many application developed by MInt is done with. So you may gain quite a bit of support in this forum as well, or take the code from Mint devs as reference sample.

"C++ with QT" is loved by somebody, but in my opinion a risky choice unless one is willing to maintain the codebase perpetually. Qt framework evolves far faster than GTK and break compatibility far faster too. Old software written for Qt3 and Qt4 has lost capacity to run on latest Linux distos as the library support has been dropped. Currently most Qt-based software are relying on Qt5 but since Qt6 has been out already, all of them are pressured to update/upgrade their code to Qt6 in near future or face losing capacity to run on Linux. This marathon is tedious.

Meanwhile, GIMP has still not finished porting to GTK3. Thus even archaic software written in GTK2 days are still safe for a while.
mudassir
Level 3
Level 3
Posts: 118
Joined: Tue Dec 12, 2023 2:28 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by mudassir »

Thanks @Valsodar and @billyswong for sharing your experiences. I need something stable to work with, so (as suggested), QT is not my bet :)

Lazarus seems great at first glance with RAD GUI Framework looks like Visual Foxpro / Visual Basic Form Designer... but (sorry to ask) is it capable to make modern interface like GTK 3 or give native interface experience on Windows 10 / 11?

Language is no barrier to me, it's just a RAD Framework to create GUI with drag and drop and capable to produce modern looking interface OR preferably give native interface when deployed to Linux or Windows systems.


Python would be my first choice if there is any Lazarus / Visual Basic / Visual Foxpro like RAD GUI Framework to work with latest GTK. Yes, google gives countless suggestions but advice from experienced coders is much more reliable to me.
Please SHARE Knowledge.. Let's not FLAUNT it...
FUN := 'Linux Mint 21 Vanessa Cinnamon' + 'Php, Apache, MySQL Server' + 'Lazarus' + 'Gambas';
const Lazarus : Pascal; const Gambas As BASIC
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by AndyMH »

billyswong wrote: Fri Jan 26, 2024 2:06 am My own personal experience in RAD GUI framework for cross-platform is Lazarus.
I was going to suggest lazarus but was thinking, no not mainstream, it will get "downvoted" by others suggesting python. Pascal is my 'goto' language, the lazarus IDE is excellent, there is a lazarus forum and it is relatively easy to get GUI apps up and running. You can use GTK or QT although to date I've stuck with GTK. Even it you switch to something else later, a good starting point (although if you switch to C++ you will find yourself saying this is so much easier with pascal = my experience).

An example of an application written in pascal with lazarus:
https://foxclone.org/
About 8,000 lines of code.

So another upvote for lazarus :D

Downside - it is GTK2 and GTK3 has been coming "real soon now" for several years, I've not found that a problem. No issues like that on the win side.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
mudassir
Level 3
Level 3
Posts: 118
Joined: Tue Dec 12, 2023 2:28 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by mudassir »

Downloaded Lazarus from here to see how things work with that. But we're open to all good suggestions from experienced people because it's just an experiment and till now I'm not even aware of Pascal basic syntax.

The package came with three deb files for:
1. fpc-laz - the Compiler, some command line tools, base units and non visual components like database access
2. fpc-src - the sources of fpc and its packages, needed for code browsing
3. lazarus-project - the IDE, visual components and help files

Installed all three packages with libgtk2.0-dev and fixed dependency issues while there is only one Shortcut in the programming menu for Lazarus. Where to find command line tools and non visual components from fpc-laz? Also is there something about fpc-src I should know?
Please SHARE Knowledge.. Let's not FLAUNT it...
FUN := 'Linux Mint 21 Vanessa Cinnamon' + 'Php, Apache, MySQL Server' + 'Lazarus' + 'Gambas';
const Lazarus : Pascal; const Gambas As BASIC
billyswong
Level 8
Level 8
Posts: 2239
Joined: Wed Aug 14, 2019 1:02 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by billyswong »

I installed Lazarus (2.2.0) through Software Manager. Thus no trouble of dependencies.

If you want to build Lazarus project through command line tools, take a look at https://wiki.freepascal.org/Using_the_L ... ut_Lazarus
So, how to build a Lazarus project without Lazarus?

The easy way

Use lazbuild. It does NOT launch Lazarus; it's just a wrapper for fpc. Running lazbuild project1.lpr should do it.
About "non visual components", no need to worry. Open the IDE and you should find all the popular database connection class/object in the toolbox for you to add into your project.

You may also take a look at https://wiki.freepascal.org/Installing_Help_in_the_IDE and install the help file into your local computer.
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by AndyMH »

mudassir wrote: Fri Jan 26, 2024 1:14 pm I'm not even aware of Pascal basic syntax.
Google, just one:
https://www.tutorialspoint.com/pascal/p ... erview.htm
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
mudassir
Level 3
Level 3
Posts: 118
Joined: Tue Dec 12, 2023 2:28 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by mudassir »

billyswong wrote: Fri Jan 26, 2024 3:01 pm I installed Lazarus (2.2.0) through Software Manager. Thus no trouble of dependencies.

If you want to build Lazarus project through command line tools, take a look at https://wiki.freepascal.org/Using_the_L ... ut_Lazarus
So, how to build a Lazarus project without Lazarus?

The easy way

Use lazbuild. It does NOT launch Lazarus; it's just a wrapper for fpc. Running lazbuild project1.lpr should do it.
About "non visual components", no need to worry. Open the IDE and you should find all the popular database connection class/object in the toolbox for you to add into your project.

You may also take a look at https://wiki.freepascal.org/Installing_Help_in_the_IDE and install the help file into your local computer.

Thanks, already reading stuff on freepascal.org and wiki.freepascal.org :)
Please SHARE Knowledge.. Let's not FLAUNT it...
FUN := 'Linux Mint 21 Vanessa Cinnamon' + 'Php, Apache, MySQL Server' + 'Lazarus' + 'Gambas';
const Lazarus : Pascal; const Gambas As BASIC
mudassir
Level 3
Level 3
Posts: 118
Joined: Tue Dec 12, 2023 2:28 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by mudassir »

billyswong wrote: Fri Jan 26, 2024 3:01 pm I installed Lazarus (2.2.0) through Software Manager. Thus no trouble of dependencies.
Sorry, just thought to download the latest one from source as repositories are not very often update.And asked if I'm missing something.
billyswong wrote: Fri Jan 26, 2024 3:01 pm About "non visual components", no need to worry. Open the IDE and you should find all the popular database connection class/object in the toolbox for you to add into your project.
Got them in the IDE, thanks. Reading stuff on freepascal.org and wiki.freepascal.org already :) Thanks for the help
Please SHARE Knowledge.. Let's not FLAUNT it...
FUN := 'Linux Mint 21 Vanessa Cinnamon' + 'Php, Apache, MySQL Server' + 'Lazarus' + 'Gambas';
const Lazarus : Pascal; const Gambas As BASIC
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by AndyMH »

mudassir wrote: Fri Jan 26, 2024 4:16 pm Sorry, just thought to download the latest one from source as repositories are not very often update.And asked if I'm missing something.
Way back, might have been LM18, the version in the repos was broke, missing some components, so I always download the debs from lazarus. If it is all there in the version in the repos then fine. I'm running lazarus 2.2.4 and FPC 3.2.2.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
mudassir
Level 3
Level 3
Posts: 118
Joined: Tue Dec 12, 2023 2:28 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by mudassir »

AndyMH wrote: Fri Jan 26, 2024 3:47 pm Google, just one:
https://www.tutorialspoint.com/pascal/p ... erview.htm
Thanks AndyMH, I will surely check that for language reference. But my priority is to play with the controls. Like, I made a Form, put some buttons, edit box and a listbox... I'm attempting to add items to the list during runtime via the edit box input on button click and to remove them from other button. Please suggest if there is some quick tutorial to help me play with the controls or maybe some example codes to download. Thanks again.
Please SHARE Knowledge.. Let's not FLAUNT it...
FUN := 'Linux Mint 21 Vanessa Cinnamon' + 'Php, Apache, MySQL Server' + 'Lazarus' + 'Gambas';
const Lazarus : Pascal; const Gambas As BASIC
mudassir
Level 3
Level 3
Posts: 118
Joined: Tue Dec 12, 2023 2:28 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by mudassir »

AndyMH wrote: Fri Jan 26, 2024 4:27 pm I'm running lazarus 2.2.4 and FPC 3.2.2.
It's Lazarus Project 3.0 at their website that I downloaded and FPC 3.2.2
Please SHARE Knowledge.. Let's not FLAUNT it...
FUN := 'Linux Mint 21 Vanessa Cinnamon' + 'Php, Apache, MySQL Server' + 'Lazarus' + 'Gambas';
const Lazarus : Pascal; const Gambas As BASIC
billyswong
Level 8
Level 8
Posts: 2239
Joined: Wed Aug 14, 2019 1:02 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by billyswong »

AndyMH wrote: Fri Jan 26, 2024 3:47 pm
mudassir wrote: Fri Jan 26, 2024 1:14 pm I'm not even aware of Pascal basic syntax.
Google, just one:
https://www.tutorialspoint.com/pascal/p ... erview.htm
The reference manual written by FreePascal devs may provide more up-to-date/detailed information. https://www.freepascal.org/docs.html
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by AndyMH »

mudassir wrote: Fri Jan 26, 2024 4:34 pm But my priority is to play with the controls...
Please suggest if there is some quick tutorial to help me play with the controls or maybe some example codes to download. Thanks again.
I'm not aware of one, not to suggest that there isn't one. I learnt by trial and error. I also don't use the form designer, I hard code all my widgets with the constructor for each object.

When I first started with lazarus I bought this:
https://www.amazon.co.uk/gp/product/150 ... UTF8&psc=1
It was worth buying.

As I suggested earlier, join the lazarus forum, friendly, but not as friendly as the LM forum. There may be stuff there.

The help in lazarus is pretty comprehensive (and what you see in help is all online):
Screenshot from 2024-01-27 10-25-16.png
But before you can make effective use of it, you need some understanding of the overall structure of lazarus - that's what the book did. I was already reasonably fluent in pascal having learnt it in the 1980's. That proved an obstacle, it took me a long time before I could get my head around OOP, my thinking was procedural.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
mudassir
Level 3
Level 3
Posts: 118
Joined: Tue Dec 12, 2023 2:28 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by mudassir »

billyswong wrote: Sat Jan 27, 2024 1:35 am The reference manual written by FreePascal devs may provide more up-to-date/detailed information. https://www.freepascal.org/docs.html
Thanks billyswong, I got the best language reference over freepascal.org.
Please SHARE Knowledge.. Let's not FLAUNT it...
FUN := 'Linux Mint 21 Vanessa Cinnamon' + 'Php, Apache, MySQL Server' + 'Lazarus' + 'Gambas';
const Lazarus : Pascal; const Gambas As BASIC
mudassir
Level 3
Level 3
Posts: 118
Joined: Tue Dec 12, 2023 2:28 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by mudassir »

AndyMH wrote: Sat Jan 27, 2024 6:35 am I'm not aware of one, not to suggest that there isn't one.
I'm working my way through Lazarus form designer but I have to find some tutorial on controls (esp. methods) as properties and events are always (almost) same for any framework.
I also don't use the form designer, I hard code all my widgets with the constructor for each object.
Form designers in VFP and VB really made me lazy :( or maybe it's my habit to create GUI using my own custom functions/procedures to get it done quickly.
As I suggested earlier, join the lazarus forum, friendly, but not as friendly as the LM forum. There may be stuff there.
The help in lazarus is pretty comprehensive (and what you see in help is all online):
Will surely go through that.
I was already reasonably fluent in pascal having learnt it in the 1980's. That proved an obstacle, it took me a long time before I could get my head around OOP, my thinking was procedural.
Procedural is best suited to me also but there is always something new to learn but any prior experience with some computer language enables us to adapt new languages faster.
Please SHARE Knowledge.. Let's not FLAUNT it...
FUN := 'Linux Mint 21 Vanessa Cinnamon' + 'Php, Apache, MySQL Server' + 'Lazarus' + 'Gambas';
const Lazarus : Pascal; const Gambas As BASIC
User avatar
Drugwash
Level 5
Level 5
Posts: 734
Joined: Fri Jun 07, 2019 6:40 am
Location: Ploieşti, RO
Contact:

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by Drugwash »

If you don't mind main author/maintainer being Russian you could take a look at the Double Commander project. It's written in Pascal and uses Lazarus so it lines up with all advices above. It has options to build either with Gtk2 or Qt5 so if you could follow its lines you could do that too for your project(s). It can also build for Windows but not under Linux (I think).

Personally I have never ever used Pascal or the Lazarus IDE before, so can't provide any advice in that regard; but after following the recommendations regarding installing tools, dependencies and whatnot I was able to succesfully build both DoubleCmd versions. So maybe something on that page could help in case you have problems with building your project.

Just in case you want to also pursue the Python alternative there is Glade Builder 3.22 that provides the means for building a Gtk3 GUI usable with a Python script. That I did use a few times. It's not too easy as the Gtk tends to make everything fluid and widgets are so dependent on one-another but in the end one can achieve more or less their goal.
Unfortunately I can't provide any direct links to Glade as the stupidity that took over the web lately made everybody into an enemy and there's that imbecility called captcha everywhere, even in an innocent search.
mudassir
Level 3
Level 3
Posts: 118
Joined: Tue Dec 12, 2023 2:28 am

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by mudassir »

Drugwash wrote: Tue Feb 06, 2024 12:11 am If you don't mind main author/maintainer being Russian you could take a look at the Double Commander project. It's written in Pascal and uses Lazarus so it lines up with all advices above. It has options to build either with Gtk2 or Qt5 so if you could follow its lines you could do that too for your project(s). It can also build for Windows but not under Linux (I think).
Thanks for your input Drugwash, I will check Double Commander.. author / maintainer being Russian? That should not be an issue for anyone. I mean why?

As far as Lazarus is concerned, I tried it upon the recommendations over here and found that it is a very good (if not best) open source RAD platform for former Visual Studio coders who used to code in Visual Basic / Visual Foxpro. Good support of a wide variety of components / controls. And contrary to the myths Language is pretty powerful and a good community. Best part is being able to compile programs for both Linux and Windows (not talking about other platforms).

Also tried GAMBAS, looks so neat and minimal but the user-base is very small. Main drawback being not able to compile the applications for Windows.
Just in case you want to also pursue the Python alternative there is Glade Builder 3.22 that provides the means for building a Gtk3 GUI usable with a Python script. That I did use a few times. It's not too easy as the Gtk tends to make everything fluid and widgets are so dependent on one-another but in the end one can achieve more or less their goal.
Unfortunately I can't provide any direct links to Glade as the stupidity that took over the web lately made everybody into an enemy and there's that imbecility called captcha everywhere, even in an innocent search.
Yeah, I read a lot about Glade and Python but never used it. Will give it a try too but now I'm trying to learn / play with Lazarus controls as I want to good alternative to VFP to port my running programs.
Please SHARE Knowledge.. Let's not FLAUNT it...
FUN := 'Linux Mint 21 Vanessa Cinnamon' + 'Php, Apache, MySQL Server' + 'Lazarus' + 'Gambas';
const Lazarus : Pascal; const Gambas As BASIC
User avatar
BwingBob
Level 3
Level 3
Posts: 183
Joined: Fri Sep 03, 2021 1:43 am
Location: Texas, USA.

Re: Which one to use for Desktop Applications: Python with GTK or C++ with QT?

Post by BwingBob »

Yeah, I read a lot about Glade and Python but never used it. Will give it a try too but now I'm trying to learn / play with Lazarus controls as I want to good alternative to VFP to port my running programs.
This topic is very close to the question in another thread. You might take a look at wxFormBuilder if you want to use Python.https://github.com/wxFormBuilder/wxFormBuilder

I posted about it here.
BwingBob wrote: Mon Feb 05, 2024 8:07 pm It's not really a plugin for Eclipse but you might take a look at wxFormBuilder https://github.com/wxFormBuilder/wxFormBuilder.

I have not used it for C/C++, mostly Python. The work flow is to build the base of your gui using the Builder, dump the source code for the design. In your application you derive your gui from the classes in the builder code and add your application logic to this derived class. This workflow allows you to modify the design without wiping out your application logic.

I prefer wxBuilder over Glade because the output is the actual source code to build the widgets, not XML to be used by some builder object. Since your code classes are derived from the classes in the builder output, the derived class is free to modify almost anything in the base class does not function/look etc. the way you want.

On Linux the underlying widget set is GTK on Windows it's WinForms so everything looks native.

Good luck.
Bob
Years ago I did a brief stent as a programmer working in a shop that used Turbo Pascal/Delphi. Back in the early 2000s I contributed a small amount of code to the Lazarus project (My name is still on the list of contributors).

Because of this thread, I downloaded and installed Lazarus in my "Programming test" VM and it looks really good. I may have to dust of my Object Pascal skills.

Give wxFormBuilder a look. It works really well.

Bob
Pop_OS! 22.04 {Dell Inspiron 15 5510}
Linux Mint Cinnamon 21 {Minisforum UM700}
Pop_OS! Thelio Mira ;-)
We have met the enemy and he is us. - Pogo
Post Reply

Return to “Programming & Development”