2

First of all (as a curiosity) please answer me something.

Can PURE Ruby be used to make GUI without using other libraries or tools?


Now let's get down to business.

I use Ruby 2.5.3 and because I have a project whose graphical interface is very complex, Qt doesn't work for me, the truth is I see it very limited and besides its license doesn't suit me.

The target OS is preferably Linux but if it works with other platforms there is no problem.

It doesn't matter if the tool to use is difficult, what matters to me is that:

* Have official and complete documentation.

* That you have a very large number of widgets.

I saw some gems that were easy to build GUI but very limited so I discarded them.

There is someone who told me that I should learn C and create the GUI with that language and combine it with Ruby, I have no problem with learning C but I don't see how I can combine the two, I've never mixed programming languages but what do you think? Is it possible to do it?

Anyway for now more important is to work alone with Ruby.

1
  • Discussing how Ruby and C can interact is a separate question. Apr 10, 2019 at 0:59

1 Answer 1

2

First, as far as "Pure Ruby", RubyTk is packaged with MRI and doesn't usually require separate installation on Windows or Mac. However, we're talking about using a GUI toolkit, so of course some GUI toolkit library is being used beyond the core Ruby interpreter. Almost all of these libraries will require some prerequisite installation steps. However, you can access the library with Ruby; you don't need to write code in any other language.

In rough subjective order of their current suitability for writing complex GUIs:

  1. Ruby-Gnome2 using GTK (Tutorial)
  2. JRubyFX using JavaFX
  3. QtRuby (qtbindings gem) and ruby-qml using Qt and KDE
  4. FXRuby and foxGUIb (source) using Fox Toolkit
  5. wxRuby and rwx using wxWidgets (Dead since 2016, but excellent native look and full features)
  6. RubyMotion using Mac OS X and iOS
  7. RubyTk
  8. MacRuby using Mac OS X (Dead since 2015)
  9. MonkeyBars using JRuby and Swing (Dead since 2015)
  10. RubyCocoa (source) (Dead since 2017)
  11. Shoes (source)
  12. Opal-UI using Opal to compile Ruby to Javascript and run it in a browser.
  13. Glimmer using JRuby and Eclipse SWT
  14. FXRuby Enhancement (Dead since 2017, also using Fox Toolkit)

You can compare GitHub statistics on these toolkits at The Ruby Toolbox. A more thorough review as of 2018 is available from Saverio Miroddi.

Scripting a browser with Selenium, Watir, or Win32OLE is a very viable option, as described by James Warren. Flammarion does this for you in an awesome way for short and simple GUIs for scripts (eg.), but is not suitable for complex applications.

Note that Ruby can access a variety of lower level interfaces eg. Windows, .NET, FFI, Java, so there's really no GUI toolkit that can't be accessed somehow.

Dead but interesting options:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.