Jsonpickle & pyqt - can it work?

31 views
Skip to first unread message

Dariusz Mąkowski

unread,
Oct 22, 2015, 9:35:41 AM10/22/15
to jsonpickle
Heya

Trying to get this code to work :

print "Printing Content"
obj = {"test":"aa"}
obj["test"] = QtGui.QLineEdit()
obj["test"].setText("Testing jsonpickle")
print obj["test"].text()
frozen = jsonpickle.encode(obj)
print frozen
aa = jsonpickle.decode(frozen)
print aa["test"]
print aa["test"].text()
layout.addWidget(aa["test"])


>>>>>>>>>>>>>>


Printing Content
Testing jsonpickle
{"test": {"py/object": "PyQt4.QtGui.QLineEdit"}}
<PyQt4.QtGui.QLineEdit object at 0x0000000002BE9168>
Traceback (most recent call last):
File "O:/Script/PyQT/Dictionary_Based_01/Dictionary_09_Object.py", line 276, in printSFun
print aa["test"].text()
RuntimeError: super-class __init__() of type QLineEdit was never called



Do you guys think that there is a way to store that object/retrieve it use for later? ? 
Reply all
Reply to author
Forward
0 new messages