Problems with SetPen

I have what is basically a custom control, using a wxMemoryDC, based
somewhat off the canvas class of the pycolorchooser, but with a scrolled
window.

Randomly, it seems that SetPen is failing.. or at least, parts of what I'm
drawing are drawn with the wrong pen. I have a pen that I use to draw a
cursor, and sometimes part of the other stuff is drawn with that pen.

I've already checked that the pen calls are always explicit before drawing
the next part, I'm not missing any SetPen calls due to conditions.

What's most confusing is that I draw a series of horizontal and vertical
lines in a loop, and often only a small part of those lines are drawn with
the wrong pen. There are no pen changes in the loops at all, so it's as
if the previously requested pen change is just taking place randomly in
the middle of a drawing loop.

Unfortunately, I haven't been able to reproduce the problem exactly. It
only happens intermittently, but still somewhat regularly.

lipid@68k.org wrote:

I have what is basically a custom control, using a wxMemoryDC, based
somewhat off the canvas class of the pycolorchooser, but with a scrolled
window.

Randomly, it seems that SetPen is failing.. or at least, parts of what I'm
drawing are drawn with the wrong pen. I have a pen that I use to draw a
cursor, and sometimes part of the other stuff is drawn with that pen.

I've already checked that the pen calls are always explicit before drawing
the next part, I'm not missing any SetPen calls due to conditions.

What's most confusing is that I draw a series of horizontal and vertical
lines in a loop, and often only a small part of those lines are drawn with
the wrong pen. There are no pen changes in the loops at all, so it's as
if the previously requested pen change is just taking place randomly in
the middle of a drawing loop.

Unfortunately, I haven't been able to reproduce the problem exactly. It
only happens intermittently, but still somewhat regularly.

If you can consistently reproduce it then please send a small sample.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!