Save the content of my GUI in jpg fromat wxpython
python, wxpython, wxwidgets
Solution
No special library is required, you have everything needed to grab the display of any windows and save to a file. Simething like this:
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 )
Problem
I am trying to build a tool that allows user to create a tree, using dynamically created and drag-gable buttons as nodes, in the GUI window. I want to add a function to my tool that allows the user to save the tree in any picture format. The saved file need not load load into my app again! Just like the Print Screen function in windows. How do I do it ? Thanks in Advance!