Is it possible to Grab a part of a window as an image? I would like (from
within wxPython) to grab a part of a wxWindow as an image. This would help
me in dragging column headers etc. around on the screen.
Any help would be appreciated.
Regards
Gerrit
···
-------------------------------------------------------------------------
This e-mail is intended only for the use of the individual or entity named
above and may contain information that is confidential and privileged,
proprietary to the company and protected by law. If you are not the intended
recipient, you are hereby notified that any dissemination, distribution or
copying of this e-mail is strictly prohibited. Opinions, conclusions and
other information in this message that do not relate to the official
business of our company shall be understood as neither given nor endorsed by
it.
This code is from the widgets sample in PythonCard
(PythonCardPrototype\samples\widgets\widgets.py) which uses something like
you describe to automatically build images for documentation of each widget
(control/component).
# w is the window you want to copy from
# ignore the file saving bit if you don't need it
bmp = wx.wxEmptyBitmap(w.size[0], w.size[1])
memdc = wx.wxMemoryDC()
memdc.SelectObject(bmp)
dc = wx.wxWindowDC(w)
memdc.Blit(0, 0, w.size[0], w.size[1], dc, 0, 0)
imgfilename = os.path.join('documentation', 'images', name + '.png')
bmp.SaveFile(imgfilename, wx.wxBITMAP_TYPE_PNG)
dc = None
memdc.SelectObject(wx.wxNullBitmap)
memdc = None
bmp = None
ka
···
-----Original Message-----
From: Gerrit Van Dyk [mailto:GerritVD@decillion.net]
Sent: Wednesday, November 13, 2002 10:22 PM
To: wxPython-users (E-mail)
Subject: [wxPython-users] Grabbing a part of a window as an image
Is it possible to Grab a part of a window as an image? I would like (from
within wxPython) to grab a part of a wxWindow as an image. This would help
me in dragging column headers etc. around on the screen.
Any help would be appreciated.
Regards
Gerrit