[PyQt] how to use a JS method from within Python ?

Stef Mientki stef.mientki at gmail.com
Fri Jul 22 22:28:53 BST 2011


On 22-07-2011 11:49, Phil Thompson wrote:
> On Thu, 21 Jul 2011 18:12:03 +0200, Stef Mientki <stef.mientki at gmail.com>
> wrote:
>> hello,
>>
>> I use CodeMirror as an editable codeeditor in a QWebView.
>> After creating an inserting CodeMirror, I get a reference to that
>> CodeMirror object.
>> Now I want to execute some of the methods of the CodeMirror object.
>> Is that possible from within Python ?
> https://launchpad.net/javascript-python-proxy
>
> ...might be of interest.
>
> Phil
thanks Phil.

you suggestion didn't work for me,
but it pointed me into the right direction:

    JS = 'Unique_Name_JS_VAR = Add_CodeMirror ( "%s" )' % TA_Nr
    frame.evaluateJavaScript ( JS )
    print  frame.evaluateJavaScript ( "Unique_Name_JS_VAR.getValue ()" )


cheers,
Stef


More information about the PyQt mailing list