[pygtk] Pickling gdk.rect

Brad Schick schickb at gmail.com
Fri Aug 10 06:47:35 WST 2007


Should pickling of gdk objects work? The example below crashes python
during the pickle.load call (on windows and linux). If I remove
pickle.HIGHEST_PROTOCOL, then pickle.dump throws an exception.

-Brad

------------------------------------

#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import pickle


rect = gtk.gdk.Rectangle(100,100)
print rect.x
file = open('rect', 'wb')
pickle.dump(rect, file, pickle.HIGHEST_PROTOCOL)
file.close()

file = open('rect', 'rb')
rect = pickle.load(file)
print rect.x
file.close()



More information about the pygtk mailing list