By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,916 Members | 1,068 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,916 IT Pros & Developers. It's quick & easy.

Tkinter canvas zooming (sortof)

P: n/a
I have a program that sucks in a list of equipment positions (Lats/Longs),
opens a Toplevel frame with a canvas set to, for example, 700x480 pixels,
and then does all of the calculations and plots the objects with 10-pixel
wide ovals and rectangles. Now I want to zoom in (or out), but I don't want
the ovals and rectangles to change size. I just want them to spread out or
get closer together. So scale() doesn't seem to be the way to go. What I
want to do is just make the "logical" canvas bigger and replot everything,
but when I reconfigure the canvas size to make it bigger the Toplevel frame
itself gets bigger. I want the frame to stay the same size, but still be
resizable. I have scrollbars, and they seem to work ok, and scrollregion
seems to do what it should, but I can't figure out how to get them to all
work together to do what I want. Help?

Thanks!

Bob
May 26 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Bob Greschke" <bo*@passcal.nmt.edu> wrote in message
news:Yv******************************@nmt.edu...
I have a program that sucks in a list of equipment positions (Lats/Longs),
opens a Toplevel frame with a canvas set to, for example, 700x480 pixels,
and then does all of the calculations and plots the objects with 10-pixel
wide ovals and rectangles. Now I want to zoom in (or out), but I don't
want the ovals and rectangles to change size. I just want them to spread
out or get closer together. So scale() doesn't seem to be the way to go.
What I want to do is just make the "logical" canvas bigger and replot
everything, but when I reconfigure the canvas size to make it bigger the
Toplevel frame itself gets bigger. I want the frame to stay the same size,
but still be resizable. I have scrollbars, and they seem to work ok, and
scrollregion seems to do what it should, but I can't figure out how to get
them to all work together to do what I want. Help?

Thanks!

Bob


After further fiddling...

I think I kind of figured this out. I could tell my plotting routine that
the canvas was twice as large as I originally made it, and it would draw
everything (i.e. if I drug the frame larger I could see more stuff off the
edge of the canvas), but the scrollbars would not "activate" so I could
scroll over to stuff off the edge of the canvas. What I was doing wrong was
not setting the scrollregion to the whole new canvas size that I used for
plotting. I kept setting it to the size of the visible canvas in the frame
or not setting it at all. I almost understand. :) Now all I have to do is
be able to grab the canvas and drag it around with the mouse and click on a
spot and have it center that spot and zoom in there.

Bob
May 26 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.