* Javascript bindings
* Javascript callbacks
* Python callbacks as arguments/return to javascript functions
* getting/setting window properties through Frame.GetProperty()/SetProperty().
* Fixed application error when closing main window.
An example of how to create bindings:
- Code: Select all
def PyTest():
print "PyTest() called"
bindings = cefpython.JavascriptBindings()
bindings.SetFunction("PyTest", PyTest)
// Pass bindings to CreateBrowser()
cefpython.CreateBrowser(... javascriptBindings=bindings ...)
Now from javascript call:
- Code: Select all
window.PyTest() // "window." is optional, "PyTest()" also works.
There is also SetProperty() method so you can bind data to window object:
- Code: Select all
bindings.SetProperty("config", {"option1": True, "option2": [1,2,3]})
"cefadvanced.py" comes with many tests for javascript bindings/callbacks, run it to see.
An application error was fixed when closing application (Issue 2). It was caused by a call to win32gui.DestroyWindow() in CloseApplication(), you should use win32api.PostMessage() instead:
- Code: Select all
win32api.PostMessage(windowID, win32con.WM_DESTROY, 0, 0)
Download CEF Python from:
http://code.google.com/p/cefpython/