Usage of BoundsEditor

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Usage of BoundsEditor

mseise
This post has NOT been accepted by the mailing list yet.
I want to use the BoundsEditor for a range selection. How do I access the High and Low values? For testing I use the RangeEditor - which works as expected. But I cannot get any values out of the BoundsEditor. Any Pointers are appreciated.

Kind regards,
Matthias

I use following (simplified code):

from traits.api \
    import HasTraits, Button, Range
from traitsui.api \
    import View, Item, Group, RangeEditor
from traitsui.qt4.extra.bounds_editor import BoundsEditor

class Parameters(HasTraits):
    rgb_range = Range(0.,1.0)
    range1 = rgb_range
    range2 = rgb_range
    eval_button = Button("Eval")  

    traits_view= View(
        Item('range1'),#, editor=BoundsEditor()),
        Item('range2', editor=BoundsEditor()),
        Item('eval_button'))


    def _range1_changed(self, value):
        print(value)

    def _range2_changed(self, *arg, **kwargs):
        print(arg)

    def _range2_changed(self, *arg, **kwargs):
        print(arg)

    def _range2_low_changed(self, *arg, **kwargs):
        print(arg)

    def _range2_high_changed(self, *arg, **kwargs):
        print(arg)

    def _eval_button_fired(self):
        print(self.range1)
        print(self.range2)


if __name__ == '__main__':
    alg = Parameters()
    alg.configure_traits()