Search code examples
rubyshoes

How to open a new window by button click in shoes ruby


i'am trying to build a GUI in shoes. But i cannot open a new window when i click on a button. please help.When i click the file button i want to open a new window which will have more buttons.

the code is :

Shoes.app(:width => 500 ,:height => 500) do 


@File =  button "FILE"  , :width => 80 , :height => 30  do
    window :title => 'new window' ,:width => 300 ,:height => 300 do
    para "hello"
    end 

end 
@File.move(300,100)

@fileimage = image 'instagram.png' , :width => 50 , :height =>50 
@fileimage.move(220,100)

@Options = button "OPTIONS" , :width => 80 , :height => 30 do 
    alert "options button"
end
    @Options.move(300,170)

@optionsimage = image 'cog2.png' , :width => 50 , :height =>50 
@optionsimage.move(220,160)

@help = button "HELP"  , :width => 80 , :height => 30do 
    alert "Help button"
    end

@help.move(300,230)

@helpimage =image 'Dzone-Logo-Square-Webtreatsetc.png',:width => 50 , :height => 50
@helpimage.move(220,220)

@about = button "ABOUT" , :width => 80 , :height => 30   do 
    alert "About button"
    end

@about.move(300,280)            

@aboutimage =image 'thumbs-up.png',:width => 50 , :height => 50
@aboutimage.move(220,280)



end

Solution

  • Here is an example for green shoes

    require 'green_shoes'
    
    Shoes.app title: "The Owner" do
       button "Pop up?" do
         window do
           para "Okay, popped up from #{owner}"
         end
       end
     end