Tkinter is extremely slow in drawing plots.... why???

revyakin revyakin at
Wed Aug 28 21:16:34 CEST 2002

I am writing a simple application which is supposed to take an array
of x,y coords, generate a plot and allow simple manipulations on the
plot for convenient analysis(scrolling, scaling, zooming). I typically
work with reltaively large
sets of points, e.g. 65 000 (x,y) tuples. My problem is that , first,
takes it forever to draw a plot, and once the plot is in the window
it's extremely slow in
scrolling, zooming, resizing, etc. I don't have programming experience
in optimizing applications, and I picked python since I've done some
CGI based coding.  So I may not know smth that make my app work very
inefficiently. Can I use python Tk at
all for my purpose? Can anyone suggest what I can do to make it work

I generate plots as following:

	fileWindow = Toplevel()
#       the following returns an array of (x,y) tuples from an
external file.
	dataset = processData(data)	

	scrollbar = Scrollbar(fileWindow,orient=HORIZONTAL)
	scrollbar.pack(side=BOTTOM, fill=Y,expand=YES)
	canvas = Canvas (master=fileWindow,height=600, width=800,

	for datum in dataset:
		item = canvas.create_line(datum[0], datum[1], datum[0]+1,
datum[1]+1, fill = 'black')

More information about the Python-list mailing list