[wxPython-users] how to draw in a window, device context

Chris Mellon arkanes at gmail.com
Mon Jun 4 09:13:19 PDT 2007


On 6/4/07, 7stud <bbxx789_05ss at yahoo.com> wrote:
> Hi,
>
> I am trying to draw a circle.  After reading about how to draw in a window
>  with device contexts in "wxPython In Action ", the following is what I came
> up with.  Of course it doesn't work.  Why?  Also, could someone explain
> each line that needs to be added?
>
> Thanks
>

<code snipped>

This "works" as far as it goes, but since you're drawing in the
__init__ it gets erased when the window is actually show and
repainted. You need to do your drawing in an EVT_PAINT handler
instead. There's a chapter in wxPIA about this. I believe it's called
"Implementing Custom Controls", but I don't have my copy handy so I
can't check this.




More information about the wxpython-users mailing list