-1
$\begingroup$
###################
# create_slider() #
###################
def create_slider(self, t0, t1):
    
    # adjust the main plot to make room for the sliders
    plt.subplots_adjust(bottom=0.25)
    
    slider = Slider(
        #                   left  botm   w     h
        ax      = plt.axes([0.25, 0.1, 0.65, 0.03]),
        label   = '"t"',
        valmin  = t0,
        valmax  = t1,
        valinit = t0,
        valstep = (t1-t0)/200.0,
        color   = 'lime'
    )
    
    slider.on_changed(self.update)
    
    plt.show()
    
##############
# __init__() #
##############
def __init__(self, p0, p1, p2, p3, t0, t1):
    
    self.create_curve(p0, p1, p2, p3, t0, t1)
    self.create_unit_lines(t0)
    self.create_slider(t0, t1)
    #
    # Slider INACTIVE IF CALLED HERE VS. IN create_slider
    #
    # plt.show()
$\endgroup$
1

1 Answer 1

0
$\begingroup$

Found answer under button issue. Need to maintain class reference to the slider. Replace "slider" with "self.slider" works.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.