First time posting to stackoverflow so i'll try to get this right...
I'm running a data acquisition module in python who's input data stream is the output of a different python module. Tkinter sliders are used to control: the scale of the x-axis of the plot (which is plotting the incoming data), and 'generation speed':
for axisnum in range( len( subplots ) ):
wScale = Tkinter.Scale( master = roots[root],
label = "View Width on Plot %s:" % ( axisnum ),
from_ = 3, to = 1000,
orient = Tkinter.HORIZONTAL,
sliderlength = 30,
length = subplots[axisnum].get_frame().get_window_extent().width,
)
wScale2 = Tkinter.Scale( master = roots[root],
label = "Generation Speed for Plot %s:" % ( axisnum ),
from_ = 1, to = 200,
orient = Tkinter.HORIZONTAL,
sliderlength = 30,
length = subplots[axisnum].get_frame().get_window_extent().width
)
wScale2.pack( side = Tkinter.BOTTOM )
wScale.pack( side = Tkinter.BOTTOM )
wScale.set( 100 )
wScale2.set( wScale2['to'] - 3 )
The problem is that, though this creates all 'n' pairs of slider widgets on the canvas only the first is actually active and moreover acts as a 'master slider' controlling all 'n' subplots simultaneously.
Slight modifications have led to the 'x and y data must be same length' being raised.
So any suggestions on how I can create tkinter sliders which control the scale of the x-axis of individual subplots on a single figure?
Update
Perhaps the problem could be in my RealtimePlotter?
Note dsets[Figure][subs][data] will get you the data points for a specific subplot; subs should typically be left at '0'.
def RealtimePlotter():
global dsets, wScalesList, wScales2List
for i in range(len(Figures_List)):
for Scale in wScalesList:
Samples = min(len(dsets[i][0][0]),Scale[0].get())
XAxis = pylab.arange(len(dsets[i][0][0])-Samples,
len(dsets[i][0][0], 1
)
for t in range(len(linenum)-1):
#we choose lineax and axnum[1] because [0] is just the figure number
(lineax[t+1])[i].set_data(XAxis,pylab.array(dsets[i][0][t][-Samples:])
(axinfo[t+1]).axis([XAxis.min(),Xaxis.max(),-1.5,1.5])
for canvas in range(len(canvasList)):
canvasList[canvas].draw()
for root in range(len(roots)):
roots[root].after(100,RealtimePlotter)