###################
# 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()
1 Answer
Found answer under button issue. Need to maintain class reference to the slider. Replace "slider" with "self.slider" works.
Am I missing something?
Missing a possible trigger for disapproval&down-votes: Which computer science / programming Stack Exchange sites do I post on? $\endgroup$