Tkinter Canvas & Fast Scrolling/Dragging

Fredrik Lundh fredrik at pythonware.com
Tue Apr 20 05:53:46 EDT 1999


Randall Hopper <aa8vb at vislab.epa.gov> wrote:
> Basically, what I want to do is turn off filling of canvas objects
> temporarily while the user is scrolling the canvas or they're dragging one
> of the shapes.  When the operation is finished (user releases the mouse),
> I'll turn fill back on.  
> 
> The idea here being that the canvas seems to be pretty responsive for me
> until it has to draw stipple shapes.  Then it's painfully slow.
> 
> I know how to do this for dragging, but I don't know where to "hook in" for
> scrolling.

I think the best way is to add bindings to the scrollbar(s).
something like:

    scrollbar.bind("<Button-1>", my_canvas.no_detail)
    scrollbar.bind("<ButtonRelease-1>", my_canvas.full_detail)

might do the trick.

another solution would be to hook into the scrollbar interface; see
http://www.dejanews.com/getdoc.xp?AN=464786051
for some details.

but that only allows you to figure out when to switch to less
detail...  you could perhaps switch back after a short timeout,
or when the user moves the mouse back into the canvas.

</F>





More information about the Python-list mailing list