Is It Possible To Open A Browser Window In Ruby Shoes?
I'm wanting to build a GUI for a Ruby application I maintain using Shoes, but one of the things I'd like to do is be able to display network graphs using the D3 javascript library.
Solution 1:
Sure, you didn't mension the color of shoes so i'll use my favorite, green shoes
require'green_shoes'
Shoes.app do
gem 'watir'
chrome_proc = Proc.new {
require'watir'
browser = Watir::Browser.new :chrome
browser.goto("http://www.google.com")
}
para link("Go to google", &chrome_proc)
end
Embedding a browser window.. I wish it could but i'd be suprised.. But you could use watir (html) as your gui all the way.
Here another way based on your comment, this is on windows but i'm sure you will know how to tranpose this to a Mac.
require'green_shoes'
Shoes.app doproc = Proc.new {
system('"C:\Users\Gebruiker\AppData\Local\Google\Chrome\Application\chrome.exe" http://www.google.be')
}
para link("Go to google", &proc)
end
Solution 2:
If you are on a Mac and just wish to open safari
You can write the following:
require'uri'
Shoes.app do
background "#EFC"
border("#BE8",
strokewidth:6)
stack(margin:12) do
para "Enter your name"
flow do@value = edit_box
button "OK", width:200, height:200do
system("open -a safari https://www.biblegateway.com/passage/?search=" + URI::encode(@value.text))
endendendend
Post a Comment for "Is It Possible To Open A Browser Window In Ruby Shoes?"