In [47]:
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
import numpy as np
#plt.subplots_adjust(bottom=0.25)
x = np.linspace(0, 20, 1000)
p1 = np.sin(x)
p2 = np.cos(x)
p3 = np.cos(x)
ax1 = plt.subplot(311)
ax2 = plt.subplot(312)
ax3 = plt.subplot(313)
plt.subplots_adjust(bottom=0.25)
ax1.plot(x, p1)
ax2.plot(x, p2)
ax3.plot(x, p3)
ax = [ax1, ax2, ax3]
for a in ax:
a.axis([0, 4, -1, 1])
plt.xlabel('x')
axcolor = 'lightgoldenrodyellow'
axpos = plt.axes([0.2, 0.1, 0.65, 0.03], facecolor=axcolor)
spos = Slider(axpos, 'Time slider', x[0], x[-1])
def update(val):
pos = spos.val
ax.axis([pos, pos+5, 0, 0.5])
fig.canvas.draw_idle()
spos.on_changed(update)
plt.show()
In [59]:
import queue
g = queue.Queue(maxsize=0)
g.put(5)
g.put([1, 2, 3])
g.put(4)
print(g.queue[0])
g.put(4)
print(g.queue[0])
print(g.get())
print(g.get())
print(g.queue)