Search code examples
objectmatplotlibwidgetsliderrectangles

matplotlib: change position of rectangle by slider


I am trying to change the xy position of my drawn rectangle by changing the slider. I achieved this for an ellipse but for the rectangle it is not working. I have no idea why?!

matplotlib widgets slider on object (Ellipse)


Solution

  • The Rectangle does not have .center

    Try using

    def update(val):
        Spiegel.set_xy((val,0))