0

I'm looking to add double buffering to a drawing function like this.

    dc = wx.PaintDC(self)
    gc = wx.GraphicsContext.Create(dc)
    #draw GraphicsPaths to the gc

I tried to first draw to a MemoryDC and then blit that back to the PaintDC:

    dc = wx.MemoryDC()
    dc.SelectObject(wx.NullBitmap)
    gc = wx.GraphicsContext.Create(dc)
    #draw GraphicsPaths to the gc
    dc2=wx.PaintDC(self)
    dc2.Blit(0,0,640,480,dc,0,0)

However, this gives me nothing but a blank screen. Am I misunderstanding how the MemoryDC is supposed to work?

Bibendum
  • 502
  • 4
  • 7
  • 18

1 Answers1

1

You need to create a bitmap, not use wx.NullBitmap.

bitmap = wx.EmptyBitmap(w, h)
dc = wx.MemoryDC(bitmap)
FogleBird
  • 74,300
  • 25
  • 125
  • 131