Julia for GUI app


a few random thoughts:

Current Gtk is rendering everything via Cairo + Pango. Their future plans is to drop Cairo and use a new toolbox with GL/EGL rendering (see https://www.bassi.io/tag/gsk-demystified/).

Yes, layout is hard. But the hard part isn’t solving the constraints, it’s formulating the problem.

Keep in mind, that both Qt and PyQt are commercial products with some ‘free’ licensing.

PyQt is doing all the heavy lifting between python and a C++ library, it’s not like the effort isn’t spend, it’s just hidden.

A drawing canvas is a rather simple thing, for any interactive UI, jou need a responsive canvas or a scene toolkit.

Hardest thing (speaking about hard problems): Find people to work on this. The ratio of users to developers is close to inf.


It solves optimization problems, so he’s saying you can use it to optimize widget locations according to some cost function to have it all be done automatically. That would be an interesting idea. If not interesting, at least fun to explore and pretty boss if you get it right, boss enough that you have to put on some shades to mask others from your awesomeness. So I totally agree:


Hardest thing (speaking about hard problems): Find people to work on this. The ratio of users to developers is close to inf.

well said.

Thats why I really suggest people wanting to write UI try Gtk.jl which is in a pretty usable state. Several members of the Julia community have put quite some effort in ensuring that installing Gtk.jl is as easy as Pkg.add(“Gtk.jl”). There are people using Gtk.jl in larger projects and there have not been that much complaints.

The most serious issue currently is that Gtk.jl lacks developer manpower.


I’ve used Gtk.jl quite a bit, and looked at alternative and I think it’s the best option right now. There’s is plenty of issues with it but you can still work around them for the most part (it’s somewhat broken on 0.5 though at the moment).

But my problem with Gtk is that it really is very rough on Windows (and also Mac), unless I have missed something. And this is made even worse on very high resolution displays.

I don’t know if that’s your issue, but I think anti-aliasing is not enabled by default on windows (there’s no settings.ini file) and fonts looks horrendous as a result.


@tknopp I agree that Gtk.jl is a great piece of work and appreciate the effort that went into it. But Gtk itself really does leave a lot to be desired and this have been a long standing complaint from Mac and Windows users. WxWindows and Qt on the other hand are well established and do look fine.

As I’m not volunteering to work on this I realise I have a small (or insignificant voise), but as a data point: Gtk really does not look fine to me and my users, to the extent that I am forced to use PyQt from Julia, which is clearly sub-optimal (I would like to try Qml.jl but can’t install it on Windows at the moment).

Here is a screenshot giving a small example of the poor quality of Gtk (notice the difference between the native title bar and the actual GUI):

Qt, Wx, libui do not have this problem, which is why it is a little frustrating that the best maintained and designed GUI library for Julia is something different.

Installing QML.jl

Well on HiDPI displays you are supposed to not need anti-aliasing as much (my display is 3840x2160).

It looks like Windows support for HiDPI in Gtk is actually on its way finally (as of this month): https://git.gnome.org/browse/gtk+//commit/?id=6abd65c83be6ba4656c5f014bc940c2eea21dfd0&utm_source=anzwix

And if I remove the DPI scaling option in Windows, by pretending that Gtk.jl is already HiDPI aware, then it starts look OK (albeit with tiny fonts and GUI elements):

So this might be useable after all!


have you tried enabling antialiasing?


Other than this font issue, I cannot see the poor quality of Gtk in your screenshot.

But I think we are actually discussing different things here. There is usability of the API, usability of the widgets and the visual experience. If the last is the most important to you it is certainly better choosing Qt or Wx.


I’m not sure if that is sufficient. Asking all users to set this obscure setting buried deep inside the Gtk dependency is hardly user friendly (unless we can make it default on Gtk installations). And it doesn’t improve much (again, compare to title bar):

As I mentioned above anti-aliasing is not the solution, but proper handling of HiDPI is. Luckily it looks like Gtk have finally got round to supporting that. Upon further investigation, the workaround I noted in my previous post, of pretending that Gtk handles HiDPI doesn’t work as the fonts become unreasonably tiny.

I’ve said repeatedly above that the API and widgets are excellent. It is the visual appearance I am discussing and this really is important. I, and I suspect most people, would like both a good API and good appearance! Maybe with an upgraded Gtk we can get that, but currently I’ll have to stick with PyQt or possibly (hopefully) QML.jl or libui.

Thanks for the suggestions! I really don’t want to come across as sour or ungrateful here, but trying to provide an additional perspective on this.


However, both require lot of work to bind them.

Do you use PyCall for that?


the julia community -in general- is interested in solving problems, not only endlessly discussing them. Your example is now quite concrete, initially it sounded like ‘no way’, now it’s visible as problem of configuration and rendering. But it looks solvable.

The Windows display engine is notorious for these scaling issues (in your example the rendering in Gtk assumes the wrong window size and is scaled up), i think i even have seen PyQT4 Examples with the same issue.

Thanks for sharing the screenshot.


I really hope to provide a viable option for native cross platform GUIs with GLVisualize, which are flexible, with easy automatic options, fast and customizable!
I will announce it officially somewhere today, but the blog post is already up if you want to check it out:

Better looks and better automatic layout could be a community effort :wink:


Just a side-note: I watched your youtube video just yesterday and was really impressed. Hope I get around to try it out really soon. Really nice work


They’re certainly among the better cross-platform GUI toolkits, but I generally find that they each have a characteristic non-native look about them. They are among the best choices though aside from building multiple platform-specific GUIs with native toolkits.


That’s interesting - I was looking at libui when I was considering to use Go, but it looks that GUI is not the right niche for it.

However, I haven’t thought there might be Julia bindings for it.

I did the Libui.jl binding before the summer when the project was having lots of momentum and seamed very promising. However, and frustratingly, the activity have stalled and I don’t know when/if it will resume. Buttons and menus are fine (see the site for screen shots, that’s what we get with Julia binding too) but it’s not even yet possible to display an image see.

I am also very interested in creating GUIs in Julia but can’t get convinced with GTK. I keep having the feeling that one day it will suddenly disappear.

I also follow Simon’s work that we all acknowledge as amazing, but while it doesn’t have Menus and a more classical set of Buttons it’s not there yet.

@sdanisch, it would be nice if you could makes a post on your plans about this and what you think will be possible to do. Another very important issue is the capability to plot both raster and vector data in the same figure and be able to interact with the vector data (uicontext menus àla Matlab, etc…)


Please feel free to open issues with feature request. That makes it easier for me to prioritize.
Best with some example images of what you’re looking for. Adding new button and menu types shouldn’t take much time :slight_smile:

I don’t know Matlab that well, but it should be no problem :wink: Depending on what you’re looking for it should work out of the box.


Whose time? It’s nice if you want to put this on your agenda, but in the mid-long term it should easy to add something from the users side.


Well Simon, there is already an open issue. In simple :innocent: terms, I need the features that allow me to port the entire Mirone into Julia


That’s the goal! It should be possible right away, but I’m not 100% happy with the design of the current API.
It misses a coherent vision.
A big thing that I want to do next is to grab all the Julia devs involved in graphics and GUIs and try to design a more coherent API for interactions and GUIs. Probably not restricted to GLVisualize.
More like trying to figure out a Julian way to do this nicely, and I will make sure that GLVisualize supports it first class.


Oh, of course! Almost forgot about it!


Count me in. I have extended Matlab GUI experience but only minor on Julia.