Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d9d08b5

Browse files
committed
Second slider in slider_demo exhibits the valstep feature, which
makes the value take on integer multiples of parameter valstep.
1 parent 82c64c2 commit d9d08b5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

examples/widgets/slider_demo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
t = np.arange(0.0, 1.0, 0.001)
1414
a0 = 5
1515
f0 = 3
16+
delta_f = 5.0
1617
s = a0*np.sin(2*np.pi*f0*t)
1718
l, = plt.plot(t, s, lw=2, color='red')
1819
plt.axis([0, 1, -10, 10])
@@ -21,7 +22,7 @@
2122
axfreq = plt.axes([0.25, 0.1, 0.65, 0.03], facecolor=axcolor)
2223
axamp = plt.axes([0.25, 0.15, 0.65, 0.03], facecolor=axcolor)
2324

24-
sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0)
25+
sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0, valstep=delta_f)
2526
samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=a0)
2627

2728

0 commit comments

Comments
 (0)