Mailing List Archive

Tkinter Canvas & Fast Scrolling/Dragging
Since the Canvas doesn't implement a "level of detail" control, I'd like
implement it.

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.

Any suggestions?

Thanks,

Randall
Tkinter Canvas & Fast Scrolling/Dragging [ In reply to ]
Randall Hopper <aa8vb@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>
Tkinter Canvas & Fast Scrolling/Dragging [ In reply to ]
Fredrik Lundh:
|Randall Hopper:
|> 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.
...
| scrollbar.bind("<Button-1>", my_canvas.no_detail)
| scrollbar.bind("<ButtonRelease-1>", my_canvas.full_detail)
...
|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.

Thanks Fredrik. I'll give it a shot.

Randall