Is there a generic window creation library where "write once run everywhere"?

Hi, I am looking for a retained-mode GUI library where I can write GUI applications where I can "write once run everywhere" on any operating system such as Windows, Linux and Android?

There are many efforts to do this, but it is a very complex and hard problem. A search for "Rust GUI" should direct you to those projects and previous similar questions.

What do you mean by a "window creation library"? You indicate you want to run it on Android but this OS doesn't have a concept of "window" :thinking:

1 Like

Is this a hard and complex issue with other languages or is it just with Rust due to the nature of the ownership model?

yeah maybe I should have worded it a bit better, but like yeah like creating menus and that kind of stuff.

All languages. If you look at the size of the GTK project, for instance. Wrapping these as e.g. gtk-rs does is complicated by the ownership model, but actually gtk-rs shows the value of Rust: it will handle gobject ownership automatically to an extent.

Would gtk-rs work on Windows and Android?

I'm not sure. It might.

1 Like

If you're willing to really do something yourself and not just use yet another library, you might want to check winit. Even if it's too low-level for you, you might find something that uses it under the hood.

1 Like
  1. Is it retained or immediate graphics?
  2. Does it support Windows as last time I heard it supports x11 and Wayland but I am not too sure if it supports Windows?

It is neither, since it does exactly what you're asking here - creating the window in a cross-platform way.

Quoting the documentation:

1 Like
  1. So like I can create GUI menus and stuff inside the window all by using winit without the need of using another graphics crate?
  2. So if I need to update a specific part of the window would it or would it refresh the entire window?

winit will set up an OpenGL context for you, but you'll need to give that context to some other crate to handle the actual drawing.

1 Like

Like gtk-rs?

am I able to just use gtk-rs to create a graphics GUI window?

Since it looks like it hasn't been posted yet,

1 Like

It has sdl2 but it is for games, it has several resources for this and it compiles for several systems.


Gtk-rs does a lot of heavy lifting, but cross platform support might not be enough to call it "write once run anywhere". It works great on Linux X11 and Wayland, and on FreeBSD. Getting a Gtk development platform set up on Windows has been described as a challenge though (wouldn't know, I haven't used windows in 20 years) and it is known to still be somewhat buggy on Mac. There is no Android support.

QT has much better cross platform support but the bindings are rather immature and you -will- have to do more of the heavy lifting yourself.

I think iced shows a lot of promise in this arena and might in the future be what you're looking for, but as of now it is somewhat lacking in layout options. Look for the iced-aw create on github for some additional widgets.


I take it that iced is in beta stage?

It is, but seems quite usable already.

1 Like
  1. Lets say I have x11 and wayland installed. So lets say I compiled it and it works fine on x11, would Iced work on wayland without needing to change code?

  2. Is it retained graphics or immediate?