def __init__(self): self.app = GtkWebkitApp() uri = 'file://' + urllib.quote( os.path.abspath(os.path.join(base, 'hello.html'))) # setup the webkit / js bridge window, webview = self.app.webkit_window(uri) self.js = GtkWebkitBridge(webview, Context()).proxy
class Main(object): def __init__(self): self.app = GtkWebkitApp() uri = 'file://' + urllib.quote( os.path.abspath(os.path.join(base, 'hello.html'))) # setup the webkit / js bridge window, webview = self.app.webkit_window(uri) self.js = GtkWebkitBridge(webview, Context()).proxy def run(self): # register app_main to run once GTK has started self.app.add_thread(self.app_main) self.app.run() def app_main(self): logging.info("first JS call...") print "your name is: %r" % (self.js.getUserInput('name'),)