[wxPython-users] buffered dc

Robin Dunn robin at alldunn.com
Fri Jul 14 07:54:33 PDT 2006


Gabriel Murray wrote:
> Ah okay - I realized after looking at doodle.py that I was writing all =

> my lines in the OnPaint() method rather than in a separate DrawLines() =

> method. I've tried to alter my code to look like doodle.py's structure, =

> but now am not getting any output at all. This is supposed to be a small =

> box with a red background and half of it painted light blue. It seems =

> that the error is coming from the DrawLines() method but I don't see =

> what it is.

The first problem is that you have an exception in the frame's __init__ =

that you are not seeing because of the output being redirected, so the =

app is not starting.  (onPaint --> OnPaint)

The main problem is that you are catching the panel's EVT_PAINT event, =

but in the event you are drawing to the frame, whose client area is =

totally obscured by the panel, so even if it draws anything it woudl not =

be seen anyway.  (self --> self.panel in OnPaint)

Finally, there are *much* more efficient ways to draw a rectangle than =

drawing 62499 1 lines of length 1.


-- =

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: buffdraw.py
Type: text/x-python
Size: 1394 bytes
Desc: not available
Url : http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20060=
714/49a18b8a/buffdraw.py


More information about the wxpython-users mailing list