[Tkinter-discuss] drawing multiple functions on the canvas

Tim Mortimer timmortimer at d2.net.au
Sat Mar 15 07:07:47 CET 2008


Hi folks,

So i've moved forward a little with Tkinter, & had a play & hack around with
some example canvas drawing code from the example directory today.

I posted a few weeks back about a creating a "function" drawing tool, but
I'm looking now to represent a number of "freehand functions" on the canvas
at the same time.

Drawing on the canvas is relatively easy.

The problem is I want to restrict my line to a "function" representation (in
the mathematical sense)

IE, as I draw relative to the canvas X axis, there should only ever be 1 &
only one y value displayed against that particular X (for each function line
anyway)

to say this another way, i want to write lists / arrays of Y values to X
indices as defined via the mouse, & then display the contents of these lists
on the canvas, all together, but each array / list represented by a
different colour line /squiggle

once I am happy with my superimposed graph of trajectories, i would hit some
sort of publish button, & the output of the function arrays / lists would be
published to .txt file so i can go off & use the data in Csound. That's the
easy bit ; )

Im not sure this is possible with tkinter, although in theory it should be
pretty simple. The best i can think of involves maybe using 1 pixel diameter
circles on the canvas or something.. the canvas.line() method after all does
some smoothing & interpolation on the mouse input data... in a way it would
be nice if my "trajectories" in the array reflected the discrete mapping
from this "post smoothing" state... 

I'm aware that a greater "hybridisation" of input & plotting functionality
might be available through some sort of wxPython / matplotlib combo ...
essentially i am, after all, "plotting" data - it's just the data I am
inputting is arbitrary / via the mouse - & the display needs to refresh
after input

I want to be sure however that I can't achieve this in Tkinter first before
i go off trying more complex tools or environments.

cheers

T.




-----
*******************
www.phasetransitions.net
hermetic music * python * csound * possibly mindless ranting
various werk in perpetual delusions of progress....

-- 
View this message in context: http://www.nabble.com/drawing-multiple-functions-on-the-canvas-tp16064458p16064458.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.



More information about the Tkinter-discuss mailing list