R. Mark Volkmann <volkmann2 / home.com> wrote: >Setting the "variable" option of a TkScale is supposed to make it get its >value from that variable reference. It seems that this doesn't work if an >object attribute used. Simply changing the "variable" option to refer to >a local variable makes it work. Can anyone confirm whether this is a known >bug in the Ruby wrapping of TkScale? Sorry for replying to this a month later -- nobody else did, and I was perusing this part of the newsgroup today. =) You can't use a member variable in the initialization block of a TkScale simply because it's out of scope. In the initialization block of a TkScale, the TkScale object is "self" and so its members (if any) are in scope; refering to the member variables of another object won't get you far. This is why you notice that it works when you use a local variable reference to the object. As you have probably learned, in ruby, there is a distinction between your objects and the variable names by which you refer to them. So when you do the following: @member = foo.new local = @member In many OOP languages, like C++, 'local' and 'member' would point to two seperate objects (via a copy constructor), but in ruby, both 'local' and 'member' point to the *same* instance of the 'foo' object! So ultimately, to bind a TkVariable via the 'variable' directive, you will have to have a local variable reference to the TkVariable. Jeremy