Opinions regarding Qt for Python for cross-platform desktop apps

My knowledge of Mac and Python is poor. It appears that there is a Github example that has briefly assessed python with a few GUI packages for the Mac App store. Since you are familiar with Python, then this may be the direction to go. Here is the link to his Github project: GitHub - davidfstr/Python-in-Mac-App-Store: Barebones Python app that can be submitted to the Mac App Store.

Here are some comments:

Any app you submit to the Mac App Store must have a GUI. In Python there are a few libraries available to create a GUI:

  • Tkinter / Tk - Built-in to Python. Just works.
    • Poorly documented. Limited widget set.
    • Overhead: Nothing
  • PyObjC / Cocoa - Full bindings to the Cocoa frameworks.
    • Reasonably documented and maintained. (But requires you to learn Cocoa.)
    • Provides full access to all OS X native widgets.
    • Overhead: Nothing
  • ctypes / Cocoa - Low-level bindings directly to Cocoa frameworks.
    • Most direct way to access native Cocoa frameworks, albeit verbose.
    • Almost no online documentation for this approach.
      • The cocoa-python library exposes a tiny subset of Cocoa using ctypes. Reading its source code is illustrative.
    • Overhead: Nothing
  • wxPython / wxWidgets
    • Well documented. Lots of widgets.
    • Note: Cannot be submitted to Mac App Store due to wxPythonā€™s reliance on deprecated QuickTime APIs.
    • Overhead: 38.7 MB uncompressed, 13.3 MB compressed
  • PySide / QT
    • Well documented. Unsure if maintained.
    • Note: The app created by py2app crashes with a segmentation fault. My guess is that the py2app needs a special ā€œrecipeā€ for PySide. I donā€™t feel like writing one myself.
    • Overhead: 16.6 MB uncompressed, 6.3 MB compressed (estimated)
  • PyQt4 / QT
    • Note: I am unable to build from source and no binary installers for OS X are available. Seriously donā€™t people test anything these days?

The above assessment leaves the following choices for Mac App Store apps:

  • Tkinter
  • PyObjC
  • ctypes

I havenā€™t succeeded on the Apple App Store yet, but since I donā€™t have any business needs, Iā€™m not in a hurry. Itā€™s possible in general, but Apple is complaining about functionality issues, and Iā€™m currently not in the mood to deal with that. :wink:

If you are interested in my experience with the Windows Store, that was quite easy:

thank you for the pointers. however it seems that the list of gui frameworks is not updated. PySide6 for example (now Qt for Python) is very well maintained by Qt group and kept up to date. However I canā€™t find updated info if there any app submitted to the mac app store. I would need to figure it out

by the way, if I am not wrong, jpackage produces a native package only (including a JRE and and the Jar of your app) and not a compiled version of the app. Am I wrong?

correct bit code running in the JVM, but jpackage includes the JVM into your binary (if you want, my above gradle script does exactly that, including tree shaking, so it ā€œcompilesā€ only the JavaFX components you are acutally using) as such that a customer doesnā€™t need to have Java installed, or the customer can have installed a ā€œwrongā€ JVM or JDK for your app, it will still work.

GraalVM will compile into native code, but it is depatable if this is something you really want, as you will loose one benefit of the JVM, the self optimization of the program and the ahead of time compilation of only those functions the users is really using, etc.

In regards of the memory consumption a lot has happend since I last worked with Java around the beginning of the century. If you wish you can finetune many parameters of your embeded JVM including the max. memory consumption etc. The ā€œold daysā€ that Java will just consume whatever is available on free memory are long gone. Jetbrains IDEs are a good example, where you can define yourself how much resources their IDEs should consume at max.

BTW, as this might be your next question. The whole binary size is approx. 50 MB, (including pkg, msi, installer), the UIs, database, program, resources ā€¦ thatā€™s reasonable im my eyes. Especially as I am currently working on another app, which is by far bigger and the size doesnā€™t increase much.

But again, Iā€™m not an evangelist of anything. I learned TypeScript, NodeJS, Go, Rust after Xojo but from a one to one comparison from what is feasible with Xojo JavaFX comes to the closest IMHO if you want an easy toolset and workflow chain. Especially as I am more a fan to develop backends, the UIs are just a ā€œmust haveā€ to satisfy my customers needs :wink: - Personally I could live with console apps :wink:

Yikesā€¦

What should we expect? Itā€™s similar to GO; if the chosen language requires a built-in ā€œruntime,ā€ thatā€™s how it operates, and we must accept the consequences. However, the difference in binary size isnā€™t as significant if you use additional functions than just ā€œHello World.ā€ Only the ā€œbasic sizeā€ is ā€œimpressiveā€ for very small apps.

Use Rust for the smallest binaries possible, but be prepared to deal with the currently limited IDE ā€œsolutionsā€ for Rust.

With Java, no one forces us to include the JVM in an app, but we must then explain the requirements to the end user. In contrast, with GO, you donā€™t have a choice; the interpreter is provided with each app - the same applies to Electron. One reason Tauri is leaner is that it doesnā€™t include the complete Chrome engine per application for visualizing our JS code. Electron includes the complete Chrome engine per application ā€¦

Ultimately, we return to the fact that cross-platform development always comes with a price: compromises!

However, Java has numerous optimizations, such as creating a custom JVM for JavaFX that includes only the necessary components / modules for a specific app, and this process can easily be automated. But, naturally, these details require diligent effort and enthusiasm to understand, and they can easily be overlooked when hastily developing a test app. Similarly, there are countless optimizations tips for Go.

Nonetheless, this debate is likely irrelevant for a Xojo user. Their IDE consumes 1 GB of space, and with plugins, it requires even more. Due to their unconventional approach, almost every developer needs multiple installations of the complete package in different versions.

What do 19 MB mean to a decade-long Xojo developer? Just kiddingā€¦ :slight_smile:

1 Like

Thank you again for your opinions and information that let me better understand my options and make a choice.
I realize that JavaFX is very powerful and you can bend it to your own desire. But it is not straightforward (as I can see with the example code provided) and requires tuning.

To me, the closest alternative for a Xojo developer is Python: simple language (not so verbose as java) and everything is concise. Together with a GUI toolkit (WxPython or Qt for Python) and with their GUI designer, it will easily allow to design UI with drag and drop.

In my opinion is a very good compromise, even if not perfect. But I will follow JavaFX evolution as I believe would be better for bigger projects.

Python is no alternative but you will learn that faster when you use it.

Javafx is straight forward and in my opinion it is even good that this verbosity is given.

So for real applications you may not find anything what has a so perfected ecosystem. Thatā€™s the point using java.

1 Like

yup, if you donā€™t want any compromises, go for XCode on Apple devices, Visual Studio for Microsoft, etc. If you are lazy like me live with the compromises. I thought that has always been the reason to work with Xojo. Now that Xojo failed, JavaFX is really IMHO not only an alternative but even better in so many ways, but yes it is of course still a compromise to any ā€œnativeā€ solution. Thank you once again for the suggestion.

Iā€™m not an evangelist. Better than hopping from one solution to the next and not realizing anything, it is a better choice to stick with one tool and get things done. There are many options and everyone has different requirements. Verbosity? That was my mantra too, until I learned that every modern Java IDE is doing 80 percent of the boring work :slight_smile:

Thatā€™s true and in so many ways also really good. Using IntelliJ is doing that work behind the curtains. You can do it manually butā€¦who wants that. For example Controllers for fxml Filesā€¦they are generated automatically with an installed plugin. That is a fast and nice helper. You can write manually. But Should you? No. There is no sense behind that. The IDE is exactly there for this Jobs. That`s it.

1 Like

exactly, only downside is the learning curve for an IDE. My above gradle script looks ā€œcomplicatedā€, but only if you donā€™t know what gradle (or maven) is all about. Comparable to using nodeJS without learning how the package manager works. But here again the IDE is doing most of the job, beside AI or a simple copy & paste after some research. There is a learning curve no doubts, but once you have your script in place you wonā€™t touch it much, if at all for any app youā€™ll write.

But thatā€™s also something that Xojo doesnā€™t publicize very much. Software development has simply become more complex and you have to learn and master several techniques. There is also no magic button in Xojo that an app just ends up in the store.

My comment was unfair and I apologize.
Earlier in the year I re-wrote a 14 mb Xojo built helper into pure Objective-C. The Objective-C version was ~160k for both current architectures. It not only improved disk usage, reduced download times, but the obj-C version can do the task and return a result before the bloated Xojo helped has even completed launching, thus improving the performance of the app it was being used in.

Which are all things that ā€˜clickā€™ with me as an improvement over Xojo, and something that I was trying to get Xojo to look into as an improvement. Granted, I canā€™t easily make the Obj-C app run on any other platform (even iOS).

I look forward to re-writing it once again, but this time in Swift, just to get a comparison there.

1 Like

Thereā€™s no reason to apologize to me, I didnā€™t feel offended at all!

Iā€™m certainly not waging a JavaFX religious war. Why would I? I was also one of those who ridiculed Java (and @thorstenstueker ).

Iā€™m more of a backend developer, the data slingshot who wants to connect systems, create something new from numerous data sources, and would rather export the result directly into PDFs or Office documents than visualize them in a UI beforehand.

After Xojo, I tried Node.js, then Go, then Rust (and Tauri). All three variants were great and better than Xojo in many aspects. I also like Python, but in my opinion, the numerous versions donā€™t always make deployment easy.

@thorstenstuekerā€™s insistence frustrated me so much that I decided to give Java another try after 20 years. I quickly discovered that it had evolved significantly from what I remembered. Even lambdas are now available. I was also impressed by JavaFX in terms of both speed and functionality. When comparing it to Xojo, the latter seems inferior (to stay polite). If someone only develops for macOS or Windows and desires a ā€œnativeā€ feeling in their apps, then by all means, use the platform-specific tools.

I donā€™t particularly care about the ā€œnativeā€ aspect, as my customers are satisfied if they can simply use a program effectively. A user interface should be easy to use and visually appealing, but no one has ever questioned me about why my apps arenā€™t ā€œnativeā€ or inquired about the size of the app. Perhaps administrators might, but they are more concerned with whether an app is easy to deploy rather than obsessing over its size. What is truly remarkable in the Java environment is the abundance of mature and free libraries, such as Apache POI, which outperforms any Xojo plugin by a significant margin.

What is indeed astonishing is the lack of promotion surrounding JavaFX. However, this is likely due to its clientele, consisting of numerous corporate users who donā€™t typically create YouTube videos quickly. Furthermore, the documentation is so comprehensive that one simply needs to read it to understand it :slight_smile:

Returning to the subject at hand, everyone should use what works best for them. The only challenge is that it takes time and experience to identify any dead ends. I began learning Java in July of last year. For the first six months, I remained skeptical and wouldnā€™t have dared to claim that I was ecstatic.

However, each individual must make that decision for themselves. I would venture to say that itā€™s wise to allow yourself some time before making a final decision on which tool to use in shaping your future. In my personal opinion, the LTS releases of Java(FX) hold a significant competitive advantage.

1 Like

Since there is windows and macos nobody asked me for native interfaces. Never.

How our two worlds are so different
I got, and still get, that kind of comment all the time

Gee that doesnt look right for ā€¦
Gee that doesnt seem to behave quite like ā€¦

About evenly split between macOS and Windows (really depending on which client it is)
NONE of my client use Linux for anything other than Web servers where the UI is all web based anyway

But, you write for a different markets than I do
Iā€™m sure thats relevant
Iā€™d guess that, depending on a persons audience, this is, or isnt, a concern

2 Likes

Let me say it so: I have many apps written in Java swing and also many in javafx. The javafx ones are mostly desktop and 9 of them are web, desktop, android and iOS written in javafx. And I wrote around 18 or 19 apps with codenameone for iOS and Android and 3 with kotlin multiplatform mobile. At the end I can say: nobody asked me for native ui.never until now.

Discussion points where development costs, usability, stability, maintainability. And thatā€™s it. Native was never asked.

Maybe two worldsā€¦

I have Linux clients in the meat industry (waterproof raspberry pi 4 with 14" display) which are running there and nobody was interested in native.

Isnā€™t that an issue caused by Xojo? It is looking on macOS very close to ā€œnativeā€, but it is only close ā€¦ I could imagine that is the reason why people are moaning, it feels like a fake Patek Philippe, if we would offer them just a home made watch, they will probably like it as it does do what it is supposed to do :slight_smile:

3 Likes

Xojo has many controls that are completely native
Not all
But many
However, thats NOT what their marketing text would have you believe
Screen Shot 2023-07-15 at 6.13.06 PM

1 Like

But it canā€™t handle native colorsā€¦ Heck, it canā€™t even handle colors with a profile.