Broken since 2.5.4.1, but I just noticed...

Several years ago, I wrote a class allowed me to draw graphics in a
ScrolledWindow. I got it working, put it in my app, and more or less forgot
about it. Checking the graphical outputs in my program was part of my test
plan, so I thought everything was okay.

Well, apparently actually SCROLLING the graphic wasn't part of the test
plan, because I discovered yesterday that it's broken. It turns out it's
been broken since wxPython 2.5.4.

If you look at the attached code, using wxPython 2.5.3.1, you'll see that
you can hit the "Draw Shapes" buttons to draw a triangle inside a square on
a canvas that is larger than the window showing it. You can scroll the
graphic around so you can see the whole thing. If you run the code with any
version of wxPython of 2.5.4.1 or later, you'll see that scrolling is
completely busted. The graphic gets badly mangled as soon as you try to
scroll. And if you re-draw the shapes, the scroll bar positions get ignored
completely.

I'm looking for help with the simplest way to get back my scrolling
functionality, preferably without radically altering my code. (I deleted a
lot of code to simplify the sample.) It seems like there ought to be a way
to offset the graphic, but I can't seem to figure it out. Blit seemed like
a good candidate, but the syntax somehow eludes me. The DoubleBuffering
page on the wiki stops just short of addressing the issue of scrolling.

I'd appreciate any help anyone cares to offer.

Thanks in advance,

David Woods
Transana Lead Developer
Wisconsin Center for Education Research
University of Wisconsin, Madison
http://www.transana.org

GCTest.py (18.7 KB)

Several years ago, I wrote a class allowed me to draw
graphics in a ScrolledWindow. I got it working, put it in my
app, and more or less forgot about it. Checking the
graphical outputs in my program was part of my test plan, so
I thought everything was okay.

Well, apparently actually SCROLLING the graphic wasn't part
of the test plan, because I discovered yesterday that it's
broken. It turns out it's been broken since wxPython 2.5.4.

If you look at the attached code, using wxPython 2.5.3.1,
you'll see that you can hit the "Draw Shapes" buttons to draw
a triangle inside a square on a canvas that is larger than
the window showing it. You can scroll the graphic around so
you can see the whole thing. If you run the code with any
version of wxPython of 2.5.4.1 or later, you'll see that
scrolling is completely busted. The graphic gets badly
mangled as soon as you try to scroll. And if you re-draw the
shapes, the scroll bar positions get ignored completely.

I'm looking for help with the simplest way to get back my
scrolling functionality, preferably without radically
altering my code. (I deleted a lot of code to simplify the
sample.) It seems like there ought to be a way to offset the
graphic, but I can't seem to figure it out. Blit seemed like
a good candidate, but the syntax somehow eludes me. The
DoubleBuffering page on the wiki stops just short of
addressing the issue of scrolling.

I'd appreciate any help anyone cares to offer.

There's nothing like posting to help you find the answer for yourself.

In wxPython 2.5.4, the wxBufferedPaintDC changed somehow, but Robin added
style=wx.BUFFER_VIRTUAL_AREA as a parameter. I don't honestly understand
the change, but adding this parameter has fixed my problem.

Sorry to bother you.

David