GUI for commandline programs

I’m looking for a simple, easy to learn, low weight GUI for use in Ruby
programs that mainly use the command line but where a bit of GUI might
be
in order.

To give a clearer idea, let me show some examples:

  1. Going to a youtube user that has multiple playlists, parsing the
    playlist then opening a GUI with a list of the playlists so you can
    chose
    which to download.

  2. At a point in the program, you need to specify a folder to store your
    data in, so you want to pop open a folder save dialog box, then continue
    with your basic commandline program.

  3. A loop in a program input a file, parses the input and creates a
    (directed acyclic) graph from it. There is a bug someplace between the
    parser and the graph generator. You put a form at the beginning showing
    input data some intermediate variables, and drawing the graph as it
    evolves to visualize what is going wrong.

I hope from these three examples that the things I am looking for in a
GUI toolkit clear. The GUI elements are incidental to the main program,
the main program is a commandline program and for some reason or other a
part of the program is made simpler with a bit of GUI. This however is
only the case if the GUI is itself simple. Spending a lot of time
setting up an application loop and a GUI justs mucks things up in this
case. Also, in each case the GUI portion is started and stopped several
times in one run of a program.

Suggestions?

Sorry for double posting, I have absolutely no idea how that happened.

PS This is on linux.

Handy G. wrote:

Suggestions?

Depends how portable you want it. Under Ubuntu you could get away with:

Text dialog

if system(‘whiptail’,’–title’,‘AARGH’,’–yesno’,‘Delete all your
files?’,‘7’,‘40’)
raise “Ha ha!”
end

GTK+ dialog

if system(‘zenity’,’–question’,’–text’,‘Delete all your files?’)
raise “Gotcha”
end

“dialog” is another, older package for text-based dialogs.

Handy G. wrote:

I’m looking for a simple, easy to learn, low weight GUI for use in Ruby
programs that mainly use the command line but where a bit of GUI might
be
in order.

To give a clearer idea, let me show some examples:

  1. Going to a youtube user that has multiple playlists, parsing the
    playlist then opening a GUI with a list of the playlists so you can
    chose
    which to download.

  2. At a point in the program, you need to specify a folder to store your
    data in, so you want to pop open a folder save dialog box, then continue
    with your basic commandline program.

  3. A loop in a program input a file, parses the input and creates a
    (directed acyclic) graph from it. There is a bug someplace between the
    parser and the graph generator. You put a form at the beginning showing
    input data some intermediate variables, and drawing the graph as it
    evolves to visualize what is going wrong.

I hope from these three examples that the things I am looking for in a
GUI toolkit clear. The GUI elements are incidental to the main program,
the main program is a commandline program and for some reason or other a
part of the program is made simpler with a bit of GUI. This however is
only the case if the GUI is itself simple. Spending a lot of time
setting up an application loop and a GUI justs mucks things up in this
case. Also, in each case the GUI portion is started and stopped several
times in one run of a program.

Suggestions?

I have used fxruby & foxGUIb successfully for a wee while.
FoxGUIb for the GUI (and it uses fxruby).

Also I’ve used Shoes.

So I can recommend either for you’re solution.

rgds,

Dave.

I should add, that will handle your case (1) and (2) happily, but not
(3).

The granddaddy of all these is Tk. I think it should be OK if you want
to draw some stuff, run the main loop while you wait for user feedback,
then break out of the main loop to carry on doing normal stuff. I don’t
think you’re constrained to a single “main loop”.

I’m looking for a simple, easy to learn, low weight GUI for use in Ruby
programs that mainly use the command line but where a bit of GUI might
be
in order.

If you want easy cross platform I might suggest something jruby-like.

anyway here’s a list:
http://wiki.github.com/rdp/ruby_tutorials_core/ruby-gui-toolkit-comparison

Enjoy!
-r

Dave,

Friday, September 3, 2010, 2:31:12 AM, you wrote:

DL> Handy G. wrote:

I’m looking for a simple, easy to learn, low weight GUI for use in Ruby
programs that mainly use the command line but where a bit of GUI might
be
in order.

To give a clearer idea, let me show some examples:

  1. Going to a youtube user that has multiple playlists, parsing the
    playlist then opening a GUI with a list of the playlists so you can
    chose
    which to download.
  1. At a point in the program, you need to specify a folder to store your
    data in, so you want to pop open a folder save dialog box, then continue
    with your basic commandline program.
  1. A loop in a program input a file, parses the input and creates a
    (directed acyclic) graph from it. There is a bug someplace between the
    parser and the graph generator. You put a form at the beginning showing
    input data some intermediate variables, and drawing the graph as it
    evolves to visualize what is going wrong.

I hope from these three examples that the things I am looking for in a
GUI toolkit clear. The GUI elements are incidental to the main program,
the main program is a commandline program and for some reason or other a
part of the program is made simpler with a bit of GUI. This however is
only the case if the GUI is itself simple. Spending a lot of time
setting up an application loop and a GUI justs mucks things up in this
case. Also, in each case the GUI portion is started and stopped several
times in one run of a program.

Suggestions?

DL> I have used fxruby & foxGUIb successfully for a wee while.
DL> FoxGUIb for the GUI (and it uses fxruby).

DL> Also I’ve used Shoes.

DL> So I can recommend either for you’re solution.

I use FxRuby for exactly that purpose and I like it a lot.

Sadly, it has reached end-of-life and neither the underlying FOX C++
library or FXRuby that uses it seem to be supported.

On Fri, 03 Sep 2010 04:20:18 -0500, Brian C. wrote:

I should add, that will handle your case (1) and (2) happily, but not
(3).

The granddaddy of all these is Tk. I think it should be OK if you want
to draw some stuff, run the main loop while you wait for user feedback,
then break out of the main loop to carry on doing normal stuff. I don’t
think you’re constrained to a single “main loop”.

I have never used Tk, though I have encountered it often. It was
actually
Tk that I ws thinking of when I wrote the post originally, but I’m
under
the impression that there are several major shortcomings with Tk (
people
with more practical experience of Tk please feel free to correct my
impressions ).

Tk itself is falling into disfavor, so it may not be viable for much
longer.

The Ruby bindings for TK are crude and iffy.

The documentation for the Ruby bindings of Tk is very poor.

The Ruby bindings for TK are not very “Ruby-like”.

As a shoes maintainer, I’m a bit biased. But since Shoes is more of an
app toolkit than ‘toss a gui on something’, it might not be right for
you in its current incarnation.

I’ve been playing around with QtRuby lately, and it’s pretty solid.