librocket : dispatchEvent [SOLVED]

Hello,

I am testing librocket, and it sounds good.
For now, I need to create from my panda program, some element in the rml dynamically.

I used createElement from document, and it works fine.

For now, I just need an example of how to put event onclick on an image, that will call a function defined in the rml.

Can you provide of an example on how to do that?
I think, it is the function DispatchEvent, but I don’t find the correct syntax.

Thank you

Copied from this page: librocket.com/wiki/documentation … l/Elements

Dispatching events

Events can be generated on an element from within Python with the DispatchEvent() function. When calling this function, the parameters are given as a Python dictionary; Rocket will convert this into an EMP dictionary when the C++ event is created.

element.DispatchEvent("open", {"object": "trapdoor", "priority": 11}, False)

Parameter keys must be strings, and values must be strings, integers or floating-point. Others will generate a KeyError or ValueError exception as appropriate.

Yeah I read this page already.

I instanciate an img element.
I wish to have onclick evenement on this image, with a python script in the rml called test for example.

element.DispatchEvent("onclick",{"object":"test","priority":11},False)

It seems to not working but I am not sure of “onclick”, and “object”.

In fact, what I want to was :

el.AddEventListener('click', "test()", True)