[PySide] how do you add a function to a script engine?

سليمان السهمي sahmi.soulaimane at gmail.com
Mon Apr 6 01:07:06 CEST 2015


I'm trying the following code:

def myAdd(context, engine):
   a = context.argument(0)
   b = context.argument(1)
   return a.toNumber() + b.toNumber()

myEngine = QScriptEngine()
fun = myEngine.newFunction(myAdd)

and getting:
AttributeError: 'PySide.QtScript.QScriptEngine' object has no attribute
'newFunction'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20150406/f5caf992/attachment.html>


More information about the PySide mailing list