From: eching Date: 2005-07-16T03:40:52+09:00 Subject: TkVarible question Hi, I am very green at Ruby and Ruby/Tk (just started working with it last week, and love it so far) I finally found a solution to the problem I was having from an old post on these boards but no clear explanation was supplied. Why does the label in the code below not reflect the value of the TkVariable? require 'tk' class Tktest attr_writer :tkvar, :label1, :button1 attr_accessor :tkvar, :label1, :button1 def change @tkvar.value = "test!" end def initialize @tkvar = TkVariable.new root = TkRoot.new {title "This is a tk test"} label1 = TkLabel.new(root) do textvariable @tkvar pack end p = proc { change } button1 = TkButton.new(root) do text "Test it" command p pack end end end t = Tktest.new Tk.mainloop =========== When I press on the button, the label text is not altered. However, in the change method, if I print the value of the TkVariable out to the command line, it prints out the correct value. Now, if I create a local varaible in the initialize method and assign the TkVariable to it, then use the local variable for the textvariable in the label, it works. If someone could explain that, I would greatly appreciate it. Thanks, eching.