Window does not get hidden when it should

require ‘gtk3’

app = Gtk::Application.new(“org.monkey.hobotz”, :flags_none)

app.signal_connect “activate” do |application|
window = Gtk::ApplicationWindow.new application
window.set_default_size(300, 10)
box = Gtk::Box.new :vertical
hidebutton = Gtk::Button.new(label: “Hide”)
hidebutton.signal_connect “clicked” do
puts “Let’s hide!!!”
window.hide
end

callbutton = Gtk::Button.new(label: “Call”)
callbutton.signal_connect “clicked” do
puts “I’m calling you…”
window.hide
system “gnome-calculator”
application.quit
end

window.add box
box.add hidebutton
box.add callbutton

window.show_all
end

app.run

I have this ruby program. Now, when I click hidebutton, the window disappears properly, but after clicking callbutton, it always stays visible after the calculator starts.

For all I know, window.hide happens before the call so it should disappear first and the application calls the other app later.
What am I missing?

1 Like

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs