Trying to find GUI options for Julia (windows + linux)


#1

I’m trying to find out what options there are for creating GUI applications with Julia. When I visit the Julia Observer GUI category it lists just 7, some of which are web UIs. It doesn’t list Gtk or any windows native GUI bindings, although I did find that there are Gtk and Tk bindings, although I’m not clear if they support Julia 1 or not.

Has anyone created Julia bindings for Nuklear (ANSI C GUI library)?

I want to use a desktop GUI because I need to be able to access the local filesystem (so users can save and load documents), and also because I want to do everything in one language. And I want to work with Julia 1.

Is there any official Julia project for creating native Julia desktop GUI bindings?


#2

AFAIK the only packages with bindings to a library that use the native GUI widgets of each platform are Libui.jl and IUP.jl, both by @joa-quim (not sure why they’re not listed in Package Observer’s listing for GUI packages). For the latter, there’s work in progress by @disciple-of-reason for compatibility with Julia 1.0 – see this thread for details.


#3

Gtk.jl works on v1.0, although there’s probably some issues left to be discovered.


#4

Blink.jl is a web UI but runs locally in Electron. With Interact.jl its turning into a pretty good solution for my needs, and I’m pretty sure it runs on all platforms. I’m not sure how easy destop-y stuff like file managing is to do with it but its obviously possible to do in atom which is also built on Electron. You can also easily server parts of it on the web with Mux if you need to.

I’m also using Gtk on 1.0 and it runs on all platforms as far as I know.


#5

I tried Gtk on Xubuntu 18.04.1 without success.

I did add Gtk at the pkg prompt in Julia 1 and it seemed to pull in a lot of stuff BinDeps … Cairo … Gtk … Unicode and gave no errors.

I then ran the ‘getting started’ example:

using Gtk

win = GtkWindow("My First Gtk.jl Program", 400, 200)

b = GtkButton("Click Me")
push!(win,b)

showall(win)

This produced an error the first time:

WARNING: Method definition curr_module() in module GLib at /home/mark/.julia/packages/Gtk/b18rN/src/GLib/GLib.jl:31 overwritten in module Gtk at /home/mark/.julia/packages/Gtk/b18rN/src/Gtk.jl:17.

but did not show a Window.

When I ran it again, again there was a short pause then nothing. I also tried the second getting started example, and that was the same.

I tried clicking the Gtk Manual’s troubleshooting link but it gave me a 404; same with the precompilation link.


#6

The warning is expected. There’s been a couple of fixes very recently, so you could try master (]dev Gtk), otherwise you can open an issue in the repo. Everything running without error but nothing showing is definitely strange.


#7

You can check out Interact. It has a filepicker widget that uses Electron (if you run it in Blink) to access local file paths, though I still need to add a save button widget (also, it would work in Blink using Electron).

Otherwise Gtk.jl works in Julia 1.0 I think. QML.jl is also very nice (to bind to the QT/QML framework) but am not sure whether it works already on Julia 1.0.


#8

I’ve added a comment to Gtk.jl issue 364

Turns out that it is a doc bug: the two ‘getting started’ examples don’t actually work unless you add the ‘non-REPL Usage’ code at the end.


#9

It mostly works, but only on my machine :wink: I still need to convert the examples and push what I have to github.


#10

Qt’s licensing is tricky for commercial apps and it is huge, so although I mostly like it a lot, I’m looking elsewhere.


#11

Libui.jl is very promising (and real small) but it’s a WIP, specially on the Libui side. Though I’m also trying to gather courage to try implement image display from a very reduced documentation. However, it’s v1.0 ready.


#12

I think at least for Julia QML.jl-based apps this is not really an issue, since by default only the parts of the library needed for QML will be installed by BinaryBuilder (still have to actually make that work). Qt can be used under LGPL, meaning it is fine to link to it even from a commercial application (QML.jl links to Qt dynamically).


#13

You’re right. I just reread the Qt LGPL license terms and they are subtly different from the last time I read and actually easier to comply with. Mind you, I wouldn’t want to use QML (that’s Julia + JavaScript + JSON) so I’d use direct Julia-Qt bindings if available.


#14

I’m not aware of anyone working on that. QML.jl is purely focussed on the QML part, so building a QtWidgets-based application is not possible using it. I chose the QML route mainly because I have the feeling that is the general future direction for Qt, and because you don’t have to wrap things like individual widgets, since those are all directly defined in the QML script.


#15

All this would probably be far easier of Cxx.jl were working, robust, and didn’t need specially compiled Julia binaries. It’s rather unfortunate that using C++ from Julia right now involves writing a fair amount of C++ code. Making bindings to something like Qt would probably require an absolutely enormous amount of work.


#16

It involves C++, it’s never going to be easy :wink:


#17

This PR makes it much easier to work with PyQt from Julia, btw. My main motivation was to get Qt slots and signals to work for Julia. […]

This should help; I don’t know enough about Qt/this or how problematic it is using Qt and doing this with Julia only, but there’s probably no good reason to avoid PyQt and PyCall.jl.