/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * from PyQt4 import QtCore def link_clicked(url) : print "click =" +url.toString() def load_progress(load) : print "load =" + str(load) app = QApplication(sys.argv) web = QWebView() web.load(QUrl("http://www.google.com")) QtCore.QObject.connect(web, QtCore.SIGNAL("loadProgress (const QUrl&"), load_progress) QtCore.QObject.connect(web, QtCore.SIGNAL("urlChanged (int)"), link_clicked) QtCore.QObject.connect(web, QtCore.SIGNAL("linkClicked (const QUrl&)"), link_clicked) web.show() sys.exit(app.exec_())