0

In a HasTraits subclass, I have the following Trait defined:

tx_lane_sel = Range(0, 12)

If I display it in my View, using:

Item('tx_lane_sel')

it works as expected, displaying a slider bar, which ranges from 0 to 12. However, if I try to display it, using:

Item('tx_lane_sel', editor=RangeEditor(mode='spinner'))

the resultant spinner only offers me choices '0' and '1'!

How do I get the spinner working correctly? That is, how do I get it to offer me the full range [0, 12]?

dbanas
  • 1,707
  • 14
  • 24

1 Answers1

0

The RangeEditor is not especially ment for Range traits. Thus, as for integers or floats, you need to specify the range by using the low=0, high=12 or the low_name or high_name editor factory attributes:

 Item("tx_lane_sel", editor=RangeEditor(low=0, high=12, mode='spinner'))
Niemerds
  • 932
  • 7
  • 12
  • Okay, thanks, but why can't a spinner be auto-initialized with the appropriate limits, just as the default widget (slider bar, I believe) is? – dbanas Mar 31 '16 at 00:03