Re: Canvas widget getting very slow [again - raw text]

Paul Allen <[email protected]> Wed, 14 Jan 2009 11:16:11 -0800
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
On Wed, 2009-01-14 at 17:08 +0100, ptk wrote:
> Hi all,
> 
> I'm using a Canvas widget to emulate a raster graphics display.
> I'm setting pixels by drawing lines of length 1.
> 
> Unfortunately the Canvas gets slow exponentially when
> a lot of such line items are added. If there are more than
> about 8000 it's getting very slow, and above 12000 it's getting
> extremely slow...
> 
> If I wait until everything's drawn and then delete everything and
> draw again, it is a bit faster. Maybe this points to an influence of
> some cache.
> 
> Does somebody know of a solution to this. Or is there a better
> widget to emulate a raster graphics display?

I believe I've used Tk::Photo for that sort of thing.  It lets you 
get/set pixel values, among other things.  I used it for the UI on 
the image database I started on about eight years ago.  My image 
cropping code uses a rubber band box that gets re-drawn on each 
mouse movement event.  It's fast enough to be perfectly smooth.

Paul Allen

--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/ptk