How to design GUI interfaces in Julia?

Coming from a windows C# (visual studio) and Java background I’m very disappointed in the lack of support for User Interface development. I know some packages exist but they are developed by an individual. Perhaps I should just go back to those packages

4 Likes

Not so sure what you mean. These days most popular are web based GUIs, and there are very good ones for Julia. If you prefer a classical graphical user interface I suggest GitHub - JuliaGraphics/QML.jl: Build Qt6 QML interfaces for Julia programs. .

What do you miss?

OK, there could be more Julia specific documentation, but the examples are a good starting point: GitHub - barche/QmlJuliaExamples: Examples for the QML.jl package

3 Likes

Thanks for the answer.
I will try QML and the examples.
Just to clarify I’m thinking about something like Android Studio

1 Like

Having done a lot of Java, one thing that is actually quite weird is that Java has its own proprietary GUI framework that is basically exclusive to the language.

The normal thing is, especially from an open source perspective, is to use one of the cross platform GUI libraries:

  1. https://www.gtk.org/
  2. https://contribute.qt-project.org/
  3. GitHub - ocornut/imgui: Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

Taking the first example you can use it from many langauges including the following:

  1. Python: The GTK Project - A free and open-source cross-platform widget toolkit
  2. Rust: Gtk – 4.0
  3. C++: The GTK Project - A free and open-source cross-platform widget toolkit
  4. JavaScript.

That said Makie, while mostly a plotting package, has quite a feel full blown GUI elements to it. I’m particularly impressed by it’s ability to switch from OpenGL to WebGL backends:

The ability to render a few sliders, buttons. and graphs and then have them render similarly on the desktop (via GLMakie) and in a web browser (WGLMakie) is deeply impressive to me. It reminds me of the lost promise of Java applets.

That said I would be wary to so quickly discount the efforts of small groups of individuals. I know it may seem scary at first but not everything must be done by a large corporation like Sun Microsysfems (RIP), Oracle, or Microsoft.

17 Likes

I think you can use Qt Quick Designer | Qt Creator Documentation to create .qml GUI design files that can be used with QML.jl, but I did not test that lately.

3 Likes

I have zero interest in using a web-based GUI. I want to be able to [eventually] build stand-alone apps (e.g. BCI Lab, ignoring that it is Matlab-based). I would also like to be able to teach graduate students fast GUI prototyping, which I can do using QT Designer and Python, but I’d like to be able to teach it using Julia.

I commend you for your work in QML.jl, but after investigating QML, it seems like a non-starter, as it requires (1) learning another language (Qml), and (2) it doesn’t seem appropriate for developing monolithic applications.

4 Likes

I looked at Gtk, but all I found was frothing-at-the-mouth hatred for it.

1 Like

What are monolithic applications? And the tutorial for PyQT also uses QML: Getting Started - Qt for Python

There are a lot of GUI interfaces available for Julia, just not the one you like most.

Background information: QT Widgets vs QML

2 Likes

Strange. Many Linux desktops use Gnome, based on GTK. One of my favorite programs, gimp, an image manipulation program, uses it and actually originated it.

3 Likes

Many popular desktop apps these days are in fact web apps. The most prominent example is my mind is VS Code. Another is the Slack client.

This is enabled by Electron.

Most people using QML to build applications do not use or program in QML directly. The way I usually encounter it is via QT Creator and QT Quick. In fact, that’s why I think @barche focused on building a QML based interface to QT.

Here’s Bart giving us an update on QML using QT 6 in July 2024:

8 Likes

Well, GTK based programs might be nice for the end user. But if you ever programmed a GUI using Delphi or a similar IDE, as a casual programmer you will not like GTK at all, you have very little control over the layout and it has a very steep learning curve. From my point of view, compared to Delphi QT is the second best choice with the advantage that it works also on Linux and the disadvantage that the complexity is higher. And the tools for working with QT Widgets are more mature than those for working with QML, as long as you are only developing desktop apps.

3 Likes

This has been quite an insightful thread for me as I hadn’t known much about different GUI toolkits (coming from Java).

I discovered https://tauri.app/ as a lightweight, faster alternative to Electron that might be good for my use case. I’m currently looking at WGLMakie from the Julia side of things.

The other thing I thought of, was using Web Assembly (WASM), but as far as I know the Julia support for it is still a way off and I’m not sure if it’s being actively developed?

1 Like

Have you checked out Genie? While it’s primarily designed for web-based GUIs and data apps, you could also use it to build desktop applications. We have a minimal working example using Electron in this repository.

3 Likes

There have been a few experimental demonstrations of Julia and wasm in the past:

1.Introduction · WebAssemblyCompiler
2. ⚡ Pluto.jl ⚡
3. Julia - A fresh approach to technical computing.

2 Likes

By monolithic (maybe not the best terminology), I mean standalone applications, like a word processor, spreadsheet, etc.

Maybe its just me and I’ve been looking in the wrong places, but nearly every tutorial I’ve found about using QTquick is about using QML. There are very few tutorials that use a prototyping/layout system like QT Creator (which seems to be broken for QML) or QT Design Studio (which seems kinda flakey in my admitted low 30 minutes of use).

I think that it is great that we have at least one flavor of QT for Julia, but that doesn’t mean that we should limit ourselves. The more the merrier, and the more avenues we create for working with Julia, the more people we can convince to adopt the language. In particular, GUI toolkits that are not only cross-platform, but also cross-language. In addition to QT another example is TCL/TK (tkInter in Python). Familiarity with a cross-platform GUI in one language makes transitioning to another language much easier.

2 Likes

And why should you not be able to create them with Julia and QML?
OK, you will need an installer like GitHub - PeaceFounder/AppBundler.jl: Bundle your Julia application , but in principle it should work.

2 Likes

Another option is CImGui.jl (disclaimer: I’m one of the maintainers), though it’s quite different from all the other options with its immediate-mode style.

2 Likes

I started following Julia back in 2012 in the hope of migrating a big GUI package of mine done in Matlab. But I think that I’m fairly hopeless by now. It’s not only to have a good GUI framework but also the impossibility of having a standalone product without a multi-gigabyte chain of package dependencies.

2 Likes

And Matlab is smaller? (The size of new version of Matlab software totally 17.2 gb). Furthermore, if you really want to you will be able to make your app 10 times smaller with Julia 1.12, see Pushing the Limits of Small Binary Creation

1 Like