KISS-UI, a simple UI tookit for Rust

#KISS-UI

A stupid-simple UI toolkit for Rust.

  • Built using only one external lib, and one crate from Crates.io (libc so it can build on Stable)

  • Uses native GUI toolkit on the given platform (Win32 APIs, GTK+ on Linux)

    • Thus, native look-and-feel at no additional cost (e.g. running GTK+ on Windows)
  • Designed from the ground-up to be easy to use and extend, with Rust paradigms in mind.

  • Can be bootstrapped in just a handful of lines of code.

"Hello, World!" example (18 LOC):

Create a textbox and show a dialog containing its text when a button is clicked:

Show two different finite progress bars and increment them every second, and an indefinite progress bar:

One button that opens a new dialog, and another that closes the current one:

9 Likes

As someone on HN noted. Pictures when discussing GUI are a must.

To elaborate: You have examples. Put a Markdown there, show each example in short and for each example, put a screenshot of GUI it produced.

I actually didn't know this would show up on HackerNews. Maybe they're just pulling from reddit.

Screenshots are on my TODO list, but I don't know if they're quite relevant. Since the framework uses the native UI toolkit on the system, it would just look like a program written with that tooklit. I guess I could link to the screenshots on the IUP site, at least.

The primary purpose of the examples is to show how little code it takes to get a GUI going. I have some experience with rgtk and conrod, and both require exposure to a much larger API surface area just to get a simple app started, conrod especially.

1 Like

I think it's not so much how it looks, but a statement that it will produce working output :smile: In view of that I'd probably go against taking IUP screenshots, since it will make it look like a sham (i.e. you're not generating your own pics, you're just CnP IUP screens).

If you lack the OS-s' to demonstrate different GUI I'm sure people here would gladly offer their native environment screens. I might provide for Windows 7, assuming I get Rust working there.

For example look at SWT which is also provides native looking GUI widgets.

1 Like

I have Windows 7 and Linux Mint machines, that covers the two primary platforms. Windows is my primary Rust dev platform as well.

This community has been pretty trusting; we take projects at face-value and build them on our own to see how they work for ourselves. Screenshots don't always do a project justice.

I'll have some screenshots up in a while.

1 Like

installing or setting up this iup doe not look very easy; as complicated as conrod;

I agree. But other communities, might not be as charitable. For example HN or Reddit general programming populace.

You can simply dump all the dynamic libraries to <Your cargo repository>/bin/<platform target> and also add that folder to your PATH variable.

On my system <platform target> is x86_64-pc-windows-gnu

The proper method is to override build scripts though.

I'm considering starting an Ubuntu PPA for IUP to make it easier for Ubunutu-family users to obtain it. I'll probably mirror the IUP SVN to GitHub and then have TravisCI build releases.

Sounds good but it's only half the truth.
IUP itself use IM, CD and another GUI.
That means you have to set up much more then just 1 external lib.
And since IUP don't support package managers right now, it's not "stupid-simple" .

We have installation instructions for Windows and Linux up on the repo now. It's little more than extracting an archive to a certain directory. The Linux binaries even come with install and uninstall scripts.

While the IUP package comes with a couple dozen libraries, it actually appears that only one DLL, the main iup.dll, is needed to run a KISS-UI application, at least when dynamic-linking on Windows. The rest of the binaries support additional features that KISS-UI currently does not make use of, which includes IM and CD. The installation instructions can be simplified accordingly.

IM is a toolkit for loading and manipulating images. It is unnecessary to create bindings for this toolkit because there's already at least one good image library written in pure Rust, PistonDevelopers/image. KISS-UI could be extended with an optional feature flag that allows it to use image buffers from this crate.

The relationship between CD and IUP is somewhat comparable to that of Cairo and GTK+. While GTK+ relies on Cairo for drawing, CD is provided for drawing primitives on a canvas created by IUP. While CD has quite a bit of potential, it is not necessary to create a UI with IUP and can be implemented in an external crate. IUP also supports creating a canvas rendered by OpenGL, for which a PistonDevelopers/graphics backend can be implemented--also externally.

While the package manager situation on Linux is unfortunate, the setup process on Windows is about as simple as it could ever be, outside of creating an installation wizard for IUP.

This is good to know.
I'm going to give KISS-UI a try this weekend.

Update:
For me KISS-UI isn't usable yet .
I don't need much but radio-buttons or buttons i can disable.
And i like to change the font-size and color.

By the way: there is a fresh Mac OS binaries package too.

I finally put up some screenshots: https://github.com/cybergeek94/kiss-ui/blob/master/SCREENSHOTS.md

They're not exactly pretty, but they do show it working.

2 Likes

I have an issue open for feature suggestions. IUP's API still has a lot of surface area I haven't covered yet, and it's hard to figure out what to do next. I've mostly just been implementing the features I think I'll need for my own applications, and I'm almost done with those.

Edit: for disabling elements, did you try BaseWidget::set_enabled()? Did that not do anything?

First do what you need.
My "Game" works well as command line tool.
A UI is just nice to have and have to wait anyway.

No, it don't work -> issue #20

Thanks for your effort.