On May 20, 2005, at 3:23 PM, bra...@om... wrote:
>
> Is there a simple way to print a PythonCard window just as it appears
> on the screen?
>
Below is a modified version of the code in the widgets.py sample which
I think should get an image of the current background (frame) or panel,
whichever you want and save that to a PNG file. I haven't tested it,
but it should work. Once you have an image on disk you should be able
to just embed the image in a simplistic HTML file and use the
HTMLEasyPrinting stuff. Hopefully that will do it. If the code below
works I could see generalizing it and maybe making it a function in
util.py
w = self # self.panel
imagesDir = "your_dir_here"
name = "your_filename_here"
bmp = wx.EmptyBitmap(w.size[0], w.size[1])
memdc = wx.MemoryDC()
memdc.SelectObject(bmp)
dc = wx.WindowDC(w)
memdc.BlitPointSize((0, 0), w.size, dc, (0, 0))
imgfilename = os.path.join(imagesDir, name + '.png')
bmp.SaveFile(imgfilename, wx.BITMAP_TYPE_PNG)
dc = None
memdc.SelectObject(wx.NullBitmap)
memdc = None
bmp = None
ka
|