From: Kero van Gelder Date: 2001-08-15T23:21:23+09:00 Subject: [ruby-talk:19779] Re: The GUI poll is in, and the results are surprising > Please don't forget what Ruby is all about in this discussion! I think > that the basic principles and idioms of Ruby should be respected in the > GUI that is made the "standard" for Ruby. > > Enjoying coding in Ruby can come to a halt when you are faced with a GUI > API that isn't Ruby's way of doing things. My take: > > Tk isn't object oriented, at least not with Ruby Syntax. > > TkButton.new { > text 'Hello, World!' > command 'exit' > pack('fill'=>'x') > } > Tk.mainloop Actually, you could write it like b = TkButton.new b.text('Hello, world!') b.command('exit') b.pack('fill'=>'x') Tk.mainloop which gives quite nicely where your objects are. Unfortunately, in Tk, pack() is not a method of b... Third method is like parent = TkRoot.new() b = TkButton.new(parent, 'text'=>"Hello, world!", 'command'=>proc { exit }) b.pack('fill'=>'x') Tk.mainloop it depends on whether you want to view 'text' and such as options of a button or as commands to the button. +--- Kero ------------------------------ kero@chello.nl ---+ | Don't split your mentality without thinking twice | | Proud like a God -- Guano Apes | +--- M38c ------- http://members.chello.nl/~k.vangelder ---+