I have a small application that loads an image in and lets me draw boxes of
different colors on it. Sounds simple, but I actually need it to do something
at work. Anyway, when the image is larger than the window, there are scroll
bars to scroll around. If I scroll somewhere and draw a box, after I let up on
the mouse button, it redraws from the upper left corner - in other words, it
doesnt just draw the box, it refreshes the whole image, but doesn't reset the
scroll bars. To get everything right, I either have to resize or scroll around
until the image is "reset". Any ideas as to how to get around this?
scroll bars. To get everything right, I either have to resize or scroll around
until the image is "reset". Any ideas as to how to get around this?
we can't help without knowing what you are doing, but:
the wxPython Demo for ScrolledWindow does drawing -- and it does this right, so I'd take a look there.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
I could post my code if you want. I just can't seem to restrict the refresh to
the visible window area. It wants to redraw everything from the upper left
without resetting the scroll bars.
I could post my code if you want. I just can't seem to restrict the refresh to
the visible window area. It wants to redraw everything from the upper left
without resetting the scroll bars.
Hmmm - never saw the demo before - looks like I just need to try and idgest it.
Thanks for the suggestion. I'll see if I can't figure out / adapt it instead.
If I get stuck I'll try here again.
I just can't seem to restrict the refresh to
the visible window area. It wants to redraw everything from the upper left
without resetting the scroll bars.
I'm also not sure what this means - -a little more detail might help.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
I could post my code if you want. I just can't seem to restrict the refresh to
the visible window area. It wants to redraw everything from the upper left
without resetting the scroll bars.
Use self.PrepareDC(dc) to adjust the DC's origin to match the scroll offset.
You can also use self.GetUpdateRegion() to find the area that needs to be repainted, which may be less than the visible part of the window.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!