Try using Blit to copy from the screen dc to a memory dc with the bitmap selected into it.
···
On 10/17/12 12:04 AM, Dae James wrote:
I use wx.DC's GetAsBitmap method. Here is my code:
sdc = wx.ScreenDC()
rect = wx.Rect(0, 0, 100, 100)
bmp = sdc.GetAsBitmap( rect )
However, the compiler prompt error:
wx._core.PyAssertionError: C++ assertion "Ok() && (rect.x >= 0) && (rect.y >= 0) && (rect.x+rect.width <= GetWidth()) && (rect.y+rect.height <= GetHeight())" failed at ..\..\src\msw\bitmap.cpp(1089) in wxBitmap::GetSubBitmapOfHDC(): Invalid bitmap or bitmap region
So how can I do this ?