Archive for the 'Open Source' category

New double slider editor

Aug 26 2009 Published by Bryce Hendrix under Pyface, Qt, Traits

Occasionally I want a slider to control 2 values, such as defining a date range or clipping parameters. In the past, I would just create 2 sliders using the RangeEditor. It worked fine, but took up 20 or so pixels and didn’t really visually show the relationship between the 2 variables.

BoundsEditor screen shot

BoundsEditor screen shot

Qt and PyQt made it ridiculously easy to create the control I wanted. I started off transcoding the Qt QSlider C++ code into python, then added the second slider. In all, its about 180 lines of Python, less than 50 of it specific to the seconds slider.

I also wrapped this into a Traits editor, which can be found at enthought.traits.ui.qt.extra.bounds_editor.BoundsEditor

6 responses so far

Older posts »

Featuring Advanced Search Functions plugin by YD