Hello All,
I have finished writing up a Ruby class to complete exactly what it is supposed to, but since it is Ruby, I have been running it through my terminal and I need this to be more user-friendly (i.e. have a GUI). So I googled this and came across Shoes, which seems to be a nice Ruby GUI toolkit, and exactly what I am looking for. However, despite my googling I can't seem to figure out how to use a Shoes GUI edit line to send an argument to the class I made. Here is the edit line
Shoes.app do
background white
para "Application Name"
stack(margin: 12) do
para "Message"
flow do
edit_line
button "Enter"
end
end
end
In short, is there some way to do a gets.chomp (or literally anything else that is similar) with this and set it equal to an instance variable?
Yes! Just assign the elements you want to keep track of to instance variables, and pass a block to the button (the block gets executed when the button is clicked). Try this: