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"
end
menu
opt=""
while (opt!="0" && opt!="1" && opt!="2" && opt!="3" && opt!="4" &&
opt!="5" && opt!="6")
puts "Choose your option (between 0 et 6)"
opt=gets.chomp
end
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
it.
I don't know start a command of the script with GTK.So help me please im
beginner :)
Thanx you.
on 2012-08-21 13:23
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.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.