Sha256: 6bca7224e948e6df926bf230bc57d474c7205c23215215c3ec4d457fa6e7abfc
Contents?: true
Size: 796 Bytes
Versions: 38
Compression:
Stored size: 796 Bytes
Contents
=begin stock.rb - Gtk::Stock sample script. Copyright (C) 2001-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Id: stock.rb,v 1.7 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk3' window = Gtk::Window.new("Gtk::Stock sample") window.signal_connect("destroy"){Gtk.main_quit} stocks = Gtk::Stock.constants.sort image = Gtk::Image.new label = Gtk::Label.new button = Gtk::Button.new("Click!") cnt = 0 button.signal_connect("clicked") do stock_name = "Gtk::Stock::#{stocks[cnt]}" label.set_text(stock_name) image.set(eval(stock_name), Gtk::IconSize::DIALOG) if cnt < stocks.size - 1 cnt += 1 else cnt = 0 end end box = Gtk::VBox.new.add(image).add(label).add(button) window.add(box).set_default_size(200,200).show_all Gtk.main
Version data entries
38 entries across 38 versions & 1 rubygems