Tkinter is extremely slow in drawing plots.... why???
fredrik at pythonware.com
Wed Sep 4 03:14:10 EDT 2002
Joseph A. Knapka wrote
> You can create the entire plot as a single canvas item,
> however, which might speed things up considerably.
> Assuming "dataset" is just a list of 2-tuples,
> then this should work:
> def flatten(l):
> import operator
> return reduce(operator.add,map(list,l),)
> item = canvas.create_line(*flatten(dataset),fill="black")
> That code will give you a smooth line connecting
> all of your data points. The "flatten()" is just
> to convert your [(x1,y1),(x2,y2),..] into an
> unstructured [x1,y1,x2,y2], which is what create_line()
create_line flattens its arguments all by itself (and in recent
versions, this is done by a really fast C function).
in other words, this should work:
item = canvas.create_line(dataset, fill="black")
<!-- (the eff-bot guide to) the python standard library:
More information about the Python-list