>>>>> "K" == Kontra, Gergely <kgergely / mlabdial.hit.bme.hu> writes:
K> All the buttons should do basically the same task, just one parameter
K> varies. So I'd like to ask if I can pass parameters to the callback
K> function. (The value of the parameter is known, when I create the
K> button.
Well, I've not understood if you a proc you can give any
parameter. Something like this
require 'tk'
$arg = ["aaa", "bbb"]
def displ(a)
puts a
end
TkButton.new() {
text 'Dismiss'
command proc{ displ($arg[0]) }
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new() {
text 'Show'
command proc { displ($arg[1]) }
}.pack('side'=>'left', 'expand'=>'yes')
Tk.mainloop
Guy Decoux