Ruby 之 TkButton 示例

require 'tk'

root = TkRoot.new
button = TkButton.new(root) {
  text "Hello, World!"
  command proc { puts "I said, Hello!" }
}
button.pack
Tk.mainloop

编程技巧