Commit f49a7dc9 authored by Romain Casati's avatar Romain Casati
Browse files

Python 3: Fix in p5 (arguments should be converted back to Javascript).

parent 06072edc
......@@ -23,7 +23,7 @@ __email__ = "romain.casati@basthon.fr"
try:
# Python 3.10
from pyodide.ffi import JsProxy
from pyodide.ffi import JsProxy, to_js as _to_js
def isJsProxy(obj):
return isinstance(obj, JsProxy)
......@@ -38,6 +38,9 @@ except ImportError:
def isJsFunc(obj):
return type(obj).__name__ == 'JsBoundMethod'
def _to_js(x, **kwargs):
return x
__all__ = ['run', 'show', 'stop', 'load_library', 'update_variables']
def __dir__(): return __all__
......@@ -103,6 +106,7 @@ class FunctionWrapper(object):
self._func_name = func_name
def __call__(self, *args):
args = tuple(_to_js(a) for a in args)
# calling corresponding function from global instance
return getattr(_instance, self._func_name)(*args)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment