K
Kujawa, Greg
I am attempting to create an array of TkScale widgets to be used for scoring
a survey. This is because there might not always be a fixed number of
scoring responses and I wanted my script to be flexible. The values of the
TkScale widgets need to be stored for future reference. Therefore I assumed
the need to associate them with TkVariable objects. Here's my code:
# Create a scale widget for scoring each category
@@scales=Array.new
@@scores=TkVariable.new.to_a
@@category.each_index { |i|
@@scales=
TkScale.new(@@survey) {
from 0
to 9
length 400
orient 'horizontal'
tickinterval 1
variable @@scores
}
}
The problem is when I try to return the values of the TkVariable array
(@@scores) all I get back is an empty pair of brackets. Any suggestions
about how I could fix this would be appreciated. I'm only about two weeks
into learning the Ruby language and don't know a lot of Tk, as I am just
googling for sample code to try to guess at this point.
Thanks!
a survey. This is because there might not always be a fixed number of
scoring responses and I wanted my script to be flexible. The values of the
TkScale widgets need to be stored for future reference. Therefore I assumed
the need to associate them with TkVariable objects. Here's my code:
# Create a scale widget for scoring each category
@@scales=Array.new
@@scores=TkVariable.new.to_a
@@category.each_index { |i|
@@scales=
TkScale.new(@@survey) {
from 0
to 9
length 400
orient 'horizontal'
tickinterval 1
variable @@scores
}
}
The problem is when I try to return the values of the TkVariable array
(@@scores) all I get back is an empty pair of brackets. Any suggestions
about how I could fix this would be appreciated. I'm only about two weeks
into learning the Ruby language and don't know a lot of Tk, as I am just
googling for sample code to try to guess at this point.
Thanks!