Pmw.Counter and Pmw.ScrolledCanvas questions

John McMonagle johnmc at velseis.com.au
Thu Jul 11 19:54:16 EDT 2002


> As for the ScrolledCanvas are you using the .scale() canvas method.  If so 
> the call looks somthing like
> 
> mycanvas.scale("ALL", xorigin, yorigin, xscale, yscale)
> 
> and setting xorigin and yorigin to the top left points from you 'zoom box' 
> should do what you want, to get those I would bbox the rectangle I guess you 
> are drawing when they do the button-3-press-move-release dance.  Oh and don;t 
> forget to call resizescrollregion() after zooming. 
> 
> This is an example that seems to work (for me!)

Thanks for those suggestions Martin.

Unfortunately I'm not using the scale method to zoom.  I actually need
to redraw all the canvas objects because I'm mapping canvas xy coords
to eastings/northings on a map.  So, from the size of the zoom box I
calculate a new scale factor at which to draw my map, I draw my map,
then I want the canvas to be scrolled to the point where the zoom box
began.

What I've got now is my map is correctly drawn after the zoom box drag
but it's starting position is at the top left of the scrolled canvas. 
After drawing items on a scrolled canvas and resizing the scrolled
region how do you programatically scroll the canvas to a desired
point.

Any ideas ?



More information about the Python-list mailing list