GUI for commandline programs

H

Handy Gandy

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?
 
H

Handy Gandy

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

PS This is on linux.
 
D

Dave Lilley

Handy said:
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.
 
B

Brian Candler

Handy said:
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.
 
B

Brian Candler

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".
 
R

Ralph Shnelvar

[Note: parts of this message were removed to make it a legal post.]

Dave,



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


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.
 
H

Handy Gandy

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".
 
S

Steve Klabnik

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top