Skip to content

Instantly share code, notes, and snippets.

@jneen
Created June 13, 2015 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jneen/e28c107c309e05fa07dd to your computer and use it in GitHub Desktop.
Save jneen/e28c107c309e05fa07dd to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'gtk3'
fname = ARGV[0]
def window(&b)
w = Gtk::Window.new
proc { w.instance_eval(&b) }
end
image = Gtk::Image.new(:file => fname)
app = window do
fixed = Gtk::Fixed.new
add fixed
button = Gtk::Button.new :label => "Quit"
button.set_size_request 80, 30
button.signal_connect "clicked" do
Gtk.main_quit
end
fixed.put button, 50, 50
image = Gtk::Image.new(:file => fname)
fixed.put image, 10, 10
Gtk.timeout_add 200 do
puts "here"
image.set_file(fname)
image.show
end
show_all
end
Gtk.init
app.call
Gtk.main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment