problems with device contexts

Hi. I am trying to use bufferedDc and all the rest just according to the ‘radargraph’ example in “wxPython in Action” source. (Maybe my problem sounds familiar because I wrote about it some months ago)

I think I have done everything well, but when the program starts, it doesnt seem to do the ‘initbuffer’ thing. It just paint what I want if I click on a button

Please, take I look at the code attached and see if you could help me

mote.py (5.87 KB)

Nevermind. I think the problem was binding paint methods to the frame instead of binding it to the window where you paint

···

On 5/26/07, fatima cabot < thisismydo@gmail.com> wrote:

Hi. I am trying to use bufferedDc and all the rest just according to the ‘radargraph’ example in “wxPython in Action” source. (Maybe my problem sounds familiar because I wrote about it some months ago)

I think I have done everything well, but when the program starts, it doesnt seem to do the ‘initbuffer’ thing. It just paint what I want if I click on a button

Please, take I look at the code attached and see if you could help me

fatima cabot wrote:

Hi. I am trying to use bufferedDc and all the rest just according to the 'radargraph' example in "wxPython in Action" source. (Maybe my problem sounds familiar because I wrote about it some months ago)

I think I have done everything well, but when the program starts, it doesnt seem to do the 'initbuffer' thing. It just paint what I want if I click on a button

Please, take I look at the code attached and see if you could help me

You are binding the EVT_PAINT handler to the frame, but everywhere else you are drawing on the panel. If you change it to process the panel's paint event then it will do what you expect.

         self.panel.Bind(wx.EVT_PAINT,self.OnPaint)

     def OnPaint(self,event):
         dc = wx.BufferedPaintDC(self.panel, self.buffer)
         event.Skip()

···

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