I have seen this code sequence described in various incarnations on these forums and is purported to work. However, most of the developers using it are on windows. I saw a vague reference somewhere that perhaps this does not work on OS X with retina displays. In fact, I am running on the latest Catalina release on a 2016 MBP. Running this code on Python 3.8.2 and wxpython 4.1.0 produces an image file (.png, .bmp, or .jpg) that is totally black. Am I missing something here:
window: ScrolledWindow = self.getCurrentFrame()
context: ClientDC = ClientDC(window)
memory: MemoryDC = MemoryDC()
x, y = window.ClientSize
emptyBitmap: Bitmap = Bitmap(x, y, -1)
memory.SelectObject(emptyBitmap)
memory.Blit(source=context, xsrc=0, height=y, xdest=0, ydest=0, ysrc=0, width=x)
memory.SelectObject(NullBitmap)
extension: str = 'png'
imageType: BitmapType = BITMAP_TYPE_PNG
img: Image = emptyBitmap.ConvertToImage()
filename: str = f'DiagramDump.{extension}'
status: bool = img.SaveFile(filename, imageType)