From: Gary Watson Date: 2006-04-15T07:21:58+09:00 Subject: Re: Q about tk buttons I'm probably misunderstanding the question, but after reading this post I wrote a quick ruby test script to see if I could increment a variable using a tkbutton and it seemed to work for me. Here is the code I used. (I don't know if this is what you are trying to do though) require 'tk' class Hi @var = 1; @b1 = TkButton.new(:text => "Click me", :command => proc {puts @var; @var += 1}).pack def initialize Tk.mainloop end end h = Hi.new() ############the first batch of code I wrote didn't have a class definition, I changed it so I could see what it would look like inside of a class, here is the original code require 'tk' var = 1; b1 = TkButton.new(:text => "Click me", :command => proc {puts var; var += 1}).pack Tk.mainloop -- Posted via http://www.ruby-forum.com/.