0

I'm trying to figure out chaquopy and understand how to call a function without arguments, but for my application I need to call a function with a String argument taken from EditText. How can I write this?

val py: Python = Python.getInstance()
     val pyObj: PyObject = py.getModule("script")


     CoroutineScope(Dispatchers.Main).launch {
         for (i in 1..1000000) {
             val integral: PyObject = pyObj.callAttr("main",function.toString() )
             setLatex(sText, integral.toString())
             delay(200)
         }
import sympy as sym
from sympy import *
def main(function):

   return sym.latex(function)
M. Yousfi
  • 578
  • 5
  • 24

1 Answers1

0

You didn't explain what function is, but if it's an EditText, then you should instead write function.getText().toString().

If that isn't the problem, please edit the question to explain what went wrong, including any error message, and post a comment below this answer to notify me. If your app crashed, you can find the stack trace by following these instructions.

mhsmith
  • 6,675
  • 3
  • 41
  • 58