Does anyone know a way for a wxPython app to grab a screenshot of the current screen or active window?
Thanks,
Michael Hipp
Heber Springs, Arkansas, USA
Does anyone know a way for a wxPython app to grab a screenshot of the current screen or active window?
Thanks,
Michael Hipp
Heber Springs, Arkansas, USA
Ed Leafe wrote:
On Jan 9, 2006, at 9:26 PM, Michael Hipp wrote:
Does anyone know a way for a wxPython app to grab a screenshot of the current screen or active window?
Dabo has a method to return the current state of every visual control, including the form (wx.Frame) object. Here's the code:
def getCaptureBitmap(self):
"""Returns a bitmap snapshot of self, as it appears in the
UI at this moment.
"""
rect = self.GetRect()
bmp = wx.EmptyBitmap(rect.width, rect.height)
memdc = wx.MemoryDC()
memdc.SelectObject(bmp)
if self.Parent is None:
dc = wx.WindowDC(self)
else:
dc = wx.WindowDC(self.Parent)
memdc.Blit(0,0, rect.width, rect.height, dc, rect.x, rect.y)
memdc.SelectObject(wx.NullBitmap)
return bmp
Looks like that ought to work. Thanks, Ed.
Michael