Meaning of these arguments?
<p>I use a flashcard program called Anki, which is written in Python. I want to write my first add-on. I'm new to Python. I'm not a techie, but I have a few years experience of jumping around inside other people's code in Java, C++, C#, and so on.</p>

<p>The flash card shows a question, for example "Capital of France?". When the "Show Answer" button is pressed, Anki displays the answer "Paris".</p>

<p>I want to grab this text "Paris", before it's shown.</p>

<p>I've arrived at this point in the Anki code. At this instant, the card shows "Capital of France?". The answer is still blank. I think I want to be able to grab  "val" (which I think is "Paris") and use it in my add-on.</p>

<pre><code>def _getTypedAnswer(self):
    self.web.evalWithCallback("typeans ? typeans.value : null", self._onTypedAnswer)

def _onTypedAnswer(self, val):
    self.typedAnswer = val        
    self._showAnswer()
</code></pre>

<p>I've been googling to try to find the meaning of this:</p>

<pre><code>("typeans ? typeans.value : null", self._onTypedAnswer)
</code></pre>

<p>I have access to all the code, and I can provide any code that might be useful to responders.</p>

<p>Thanks.</p>

<hr>

<p>Added: after questions from responders.</p>

<p>Anki can be run on a computer or on the internet. All the results of studying cards are synced, so there's no difference between one method or the other as far as the end user is concerned.</p>

<hr>

<p>From the "webview" class:</p>

<pre><code>def evalWithCallback(self, js, cb):
    self.page().runJavaScript(js, cb)
</code></pre>

<hr>

<p>The "reviewer" class shows the questions and answers. The reviewer window is "mw" (for "main window")</p>

<p>Here's the init statement for class "reviewer"</p>

<pre><code>def __init__(self, mw):
    self.mw = mw
    self.web = mw.web
</code></pre>

<p>Once you have found a place in the code that the variable you want is found, there are a number of ways of extracting this information to your own code.</p>

<p>If direct manipulation of the source is allowed then you could assign val as an attribute to a different object within the methods you have shown in the question.</p>

<p>For instance:</p>

<pre><code>def _onTypedAnswer(self, val):
    self.typedAnswer = val
    myobj.answer = val
    # or call a method on myobj to break flow
    # myobj.method(val)
    self._showAnswer()
</code></pre>

python anki