def METHOD_NAME(self,event):
    DC = wx.PaintDC(self)
    #self.PrepareDC(DC)
    s = self.GetVirtualSize()
    MemBitmap = wx_compat.EmptyBitmap(s.GetWidth(), s.GetHeight())
    #del DC
    MemDC = wx.MemoryDC()
    OldBitmap = MemDC.SelectObject(MemBitmap)
    try:
        #DC.BeginDrawing()
        self.DoPaint(MemDC)
        DC.Blit(0, 0, s.GetWidth(), s.GetHeight(), MemDC, 0, 0)
        #DC.EndDrawing()
    finally:
        del MemDC
        del MemBitmap