擅长:python、mysql、java
<p>不需要特殊的库,你有一切需要抓取任何窗口的显示并保存到一个文件。这样模拟:</p>
<pre><code> 1 def OnSaveToFile( self, event ):
2 context = wx.ClientDC( self )
3 memory = wx.MemoryDC( )
4 x, y = self.ClientSize
5 bitmap = wx.EmptyBitmap( x, y, -1 )
6 memory.SelectObject( bitmap )
7 memory.Blit( 0, 0, x, y, context, 0, 0)
8 memory.SelectObject( wx.NullBitmap)
9 bitmap.SaveFile( 'test.jpg', wx.BITMAP_TYPE_JPEG )
</code></pre>