With what tools can I make a complex and advanced GUI with Ruby?


#1

Hi.

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.


#2

You can try Ruby-Gnome2 :
docs :
http://ruby-gnome2.osdn.jp/hiki.cgi?Ruby%2FGTK
codes;


#3

Thanks.

Unfortunately I no longer like the idea of GUI with libraries or Ruby gems. I’ve been investigating and some have very poor documentation or GUI are ugly or limited, but Ruby is very useful to me, so what other language do you recommend I learn to program the GUI and unify it with Ruby?

I’ll explain.

My idea now is to program the GUI with another language and solve the problems with the Ruby script, but I do not know if that is possible and if so, what combination of tools do you recommend? but I would like to be able to create an .exe and that the user does not need to install the Ruby interpreter is that possible? or the interpreter will be mandatory? if it also works on Linux, better.


#4

Here is a list of cross platform gui libraries.

A number of them has Ruby bindings. Like GTK, wxWidgets etc. But these can be usually outdated.

If you want fully up-to-date support, I guess you will have to write in C++.


#5

According to C++ but I will use it exclusively for the GUI, my question is how do I program the behavior with Ruby? How do I unify the two? An example not bad.


#6

Here some ideas, but without examples :slight_smile:

Use a navigator as GUI frontend, and call request to a ruby server :

  • electron or nw.js
  • javascript framework for GUI: vue.js/vuetify, amcharts for 2D, three.js for 3D view
  • request to ruby server, via HTTP/ajax or WebSocket / json

Another solution is to use a ruby interpreter in GUI environment:

  • JVM: Java, JavaFX, swing, JRuby
  • JVM: Java, Eclipse plugin, (swt), JRuby
  • node.js+opal : Electron with Opal as a ruby interpreter

Jvm or electron gives installer generator for targeting multiplatform

For all these solutions, you will not find complete, rich documentation…

see:

https://github.com/ghivert/proton-sample-apps
https://github.com/AndyObtiva/glimmer
https://github.com/zach-capalbo/flammarion


#7

Clarify two things for me:
“Use a navigator as gui frontend”
Does that mean the application will only work in one browser?

JRuby is like a kind of preprocessor for Java? So I write the programming in Ruby and then it transforms into Java code?


#8

Really? We’ve got rails. Why look any further? It does everything you’ll ever need.


#9

But I need to make desktop applications and not web pages. Are you using Rails to program GUI cross-platform and desktop application?


#10

“Use a navigator as gui frontend”

Electron (or nws) is chromium code, modified for to be a platform for heavy GUI application.
You get document/2d draw( canvas and svg), 3D draw (webgl), video, audio, big widgets frameworks …
All that are portable,multiplateforme installer, with full access to localhost (files,tcp/udp, ipc …)

JRuby is like a kind of preprocessor for Java?

It is a full interpreter of ruby lang, conform to ruby spec.

The only issues are :

  • startup time, too big,
  • threading: jvm threading, more heavy than MRI (but no GIL)
  • execution time generaly better then MRI ruby,
  • can’t access to specific C API, so some framework are rewritten in java (event-machine, nokogiri…)

#11

I didn’t see FXRuby mentioned here. It uses Ruby to access the C++ FOX tool kit.
I just installed it and ordered the book:
FXRuby
Create Lean and Mean GUIs with Ruby
by Lyle Johnson
The book is out of print but used copies are available on Amazon.
Also available on www as PDF/


#12

If I “mentioned” it:

Unfortunately I no longer like the idea of GUI with libraries or Ruby gems. I’ve been investigating and some have very poor documentation or GUI are ugly or limited, but Ruby is very useful to me, so what other language do you recommend I learn to program the GUI and unify it with Ruby?


#13

All right, I’ll try JRuby and see how bad the disadvantages are in my case.

But there’s still something I want to know. How can I join two programming languages? I have seen several projects in which some program the GUI with C++ and that the most complicated thing they do with a scripting language, the question is that I would like to do that, but without libraries because if I use them I won’t know how that works. The latter is for learning purposes.


#14

Sorry. I told you all I know.