Saving A Kivy Widget To A File
So I'm trying to save a kivy widget to a file using cpickle and I get an error. from kivy.uix.widget import Widget import cPickle as pickle foo = Widget() bar = open('bar.dat', 'w
Solution 1:
Looks like using higher protocol may help:
#!/usr/bin/python
# -*- coding: utf-8 -*-
try:
import cPickle as pickle
except:
import pickle
from kivy.uix.widget import Widget
w = Widget()
w.test = 5
data_string = pickle.dumps(w, protocol=pickle.HIGHEST_PROTOCOL)
x = pickle.loads(data_string)
print x.test
Post a Comment for "Saving A Kivy Widget To A File"