Posted By

wearetherock on 10/09/09


Tagged

python webkit pyqt


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

vkolev
gartenstuhl


PyQt4 and Webkit


 / Published in: Python
 

  1. import sys
  2. from PyQt4.QtCore import *
  3. from PyQt4.QtGui import *
  4. from PyQt4.QtWebKit import *
  5. from PyQt4 import QtCore
  6.  
  7. def link_clicked(url) :
  8. print "click =" +url.toString()
  9.  
  10. def load_progress(load) :
  11. print "load =" + str(load)
  12.  
  13. app = QApplication(sys.argv)
  14. web = QWebView()
  15. web.load(QUrl("http://www.google.com"))
  16.  
  17. QtCore.QObject.connect(web, QtCore.SIGNAL("loadProgress (const QUrl&"), load_progress)
  18. QtCore.QObject.connect(web, QtCore.SIGNAL("urlChanged (int)"), link_clicked)
  19. QtCore.QObject.connect(web, QtCore.SIGNAL("linkClicked (const QUrl&)"), link_clicked)
  20.  
  21. web.show()
  22. sys.exit(app.exec_())

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: wearetherock on October 9, 2009

my event didn't work

You need to login to post a comment.