From: Egor Z. <ez...@gm...> - 2008-11-26 12:03:08
|
Dear matplotlib devels, I wrote a selection widget someone else might find useful. The widget is based on the slider widget. Things I implemented: * blitting (bar still flashes once when clicked on, sorry about that!) * Horizontal or vertical direction * Multiple selection bars on a figure * interaction between two bars to set a range Things I struggled with: * When a bar is dragged towards one of the figure edges too quickly, it gets stuck in its last recorded position on the graph (that should be the figure edge). * Don't know how to change the mouse pointer when on top of the bar (the <-> pointer for a vertical bar would be nice) * Don't know how to define a range in pixels around the bar (for grabbing), so used 0.01 of the full range instead * Haven't implemented dragging when a bar reaches the other bar (set with set_barmin or set_barmax) but hasn't reached the limit of its range. How to test: have mplbar.py and test_bar.py in the same directory, launch test_bar.py Hope this all makes sense (somehow I doubt it). And like I said, if you guys like it or want to adapt it further, please do, the code this is based on is yours after all! Regards, Egor |