0

I'm using PyWebKitGTK on pygobject to embed a WebView into my application. I need to call some python methods from JS code, so I try to use the script-prompt signal.

How do I assign the the text parameter? In C/++, it would be a pointer, so I could write data there (I suppose? Didn't have much C experience), but here it is object:

text (object) – To be filled with the return value or None if the dialog was cancelled.

Ale
  • 1,998
  • 19
  • 31
  • I believe you are misunderstanding the purpose of the signal. It is emitted when some JavaScript uses the prompt function to get input from the user. Webkit will display a dialog box with a message and an input field, where the user is supposed to place its answer to the message (like *"Please enter your email:"*). When the user clicks "OK", the content of the input field is placed into the `text` parameter and the signal is emitted. – Cilyan Mar 29 '15 at 15:51
  • http://www.w3schools.com/jsref/met_win_prompt.asp – Cilyan Mar 29 '15 at 15:54
  • @Cilyan Nope, the signal gets called _before_ the dialog is shown, so we can misuse it :) If we `return True`, the dialog won't be shown to user and the `text` will be used as a return value. Consider this: https://gist.github.com/iamale/b91e7f06056259841d3f – Ale Mar 29 '15 at 16:23

0 Answers0