Forum: Ruby-Gnome 2 How running GTK for a beginner?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
E4897cbbfe8873885234ab136be7ed7d?d=identicon&s=25 David E. (florian_b)
on 2012-08-21 13:23
Hello guys :)

Im learning GTK and im doing ruby project with GTK2 so how to use GTK2
with my ruby script?

I create windows for the user but when the user cliked on the buttom i
would like the result appear in the same GTK windows.
For example this is a part of my script which work fine without GTK in a
simply shell:

def menu
  puts "~~~~~~~~~~~~~~~~~~ 0 - start"
  puts "~~~~~~~~~~~~~~~~~~ 1 - see"
  puts "~~~~~~~~~~~~~~~~~~ 2 - take"
  puts "~~~~~~~~~~~~~~~~~~ 3 - more?"
  puts "~~~~~~~~~~~~~~~~~~ 4 - Convert GIF to PNG"
  puts "~~~~~~~~~~~~~~~~~~ 5 -Convert PNG to GIF"
  puts "~~~~~~~~~~~~~~~~~~ 6 - Choose mor options"
      while (opt!="0" && opt!="1" && opt!="2" && opt!="3" && opt!="4" &&
opt!="5" && opt!="6")
      puts "Choose your option (between 0 et 6)"

So now i would like to have six windows in GTK2 for the user wich using
"gets.chomp" or another like this to save the user option and starting

I don't know start a command of the script with GTK.So help me please im
beginner :)

Thanx you.
4828d528e2e46f7c8160c336eb332836?d=identicon&s=25 Robert Heiler (shevegen)
on 2012-08-24 20:38
Download the official source.

In ruby-gnome look at gtk2/ directory

there is a sample/ subdirectory.

You will find a few hundred different .rb files in total

I learned a lot from studying them.

You should look through them and run them. Then you know what ruby-gnome
can do for you.

To your question:

"I don't know start a command of the script with GTK."

First, make a simple layout of what you need.

Then use specific widgets.

In your example, you could use a Gtk::Table and buttons into
that table.
This topic is locked and can not be replied to.