Current state of GUI development in Rust?

There are two GUI toolkits I know of that I would expect to work well with rust. One is iup for which rust bindings have been written a couple of times (and now seem abandoned?). The other is Tcl's Tk library.

The Tk library is much maligned because it isn't pretty on Linux (although using a theme helps) & probably wouldn't satisfy Mac purists. But it looks fine (i.e., native) on Windows 7 (Tk 8.5 or later). Tk uses inheritance in the conventional GUI sense that if you create say a frame (e.g., a window), you pass that frame as the parent of the widgets you create inside it. But Tk being originally for Tcl, everything is really passed purely as text strings. So if you do (in pseudo-code) frame = ttk.Window(options), the frame is not an object but just a string that is used internally by Tk to identify the frame (e.g., ".frame"). So if you then do checkbox = ttk.Checkbox(frame, options), the frame is still just a string, as is the checkbox (e.g., ".frame.checkbox"). So this should be "easily" translatable into Rust. I should mention however, that I don't know of anyone succeeding in writing bindings for Tk directly; I think most bindings are to Tcl and access Tk through that. Again, there are a couple of rust bindings for Tcl (and again, both seem to be abandoned).

For Windows-only, an interesting prospect seems the pure rust xi-win-shell library, part of https://github.com/google/xi-win; this uses the win32/directx bindings so seems to `just work'.

I have written a command line tool in rust that I'm very happy with. This is aimed at technical users. But I also want a GUI that offers similar functionality for non-technical users. I only need this on Windows. I looked at the win32 API but that seems intimidatingly large (& I'm not familiar with it). I tried Conrod but it won't run on Win-7-64 with rust 1.2[4-6]. I tried SDL2 but it doesn't have widgets and creating them all would be too time consuming. Gtk only seems to work with the mingw compiler on windows & I'm using the msvc toolchain; and in any case Windows seems to be a second-class citizen for Gtk which seems to model the Mac rather than Windows-style GUIs. I also tried sciter which does work, but it doesn't have many widgets (e.g., no tab widget), and although you can make them, I prefer to write all my GUI code in code not a mixture of code/HTML/CSS. I also tried the rust bindings for imgui and libui, again without success.

So, in the end I've started to create the GUI using Python 3/Tkinter (Python's Tk bindings) & will use std::process::Command to execute a rust app that I've created that wraps the same functionality as the command line tool provides. (I didn't use Qt because it would double the download size to 20+MB and because Qt 5's license isn't suitable for my needs.)

I really hope that rust gets good GUI bindings (or better still its own native GUI toolkit). But clearly it isn't easy or quick to do.

4 Likes