[wxPython-users] saving/loading an ogl diagram and shapes

Robin Dunn robin at alldunn.com
Wed May 2 13:54:38 PDT 2007


Mathew Yeates wrote:
> Hi
> I want to be able to save a user created ogl diagram containing shapes. 
> Unfortunately, because of the use of SWIG I can't just use pickle. Does 
> anyone have any suggestions on what would be the simplest way to do this?

Something that could be done is to modify the shape classes to be pickle 
friendly.  Basically you just need to add some methods that specify what 
data should be pickled and how to take that data and construct a new 
instance.  If the data doesn't include any SWIG generated classes (that 
haven't already been made pickle-friendly themselves) then it should 
pickle just fine.

BTW, it's not clear from your later message whether you know that the 
OGL shape classes are not generated by SWIG anymore.  They're all 
written in Python now, but they may have references to some classes 
(such as the OGL Canvas class) that do derive from SWIGged classes.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list