ich möchte den Quelltext einer besuchen Seite ausgeben lassen:
Code: Alles auswählen
from PyQt4 import QtCore, QtGui, QtWebKit
import sys
app = QtGui.QApplication(sys.argv)
webview = QtWebKit.QWebView()
webview.load(QtCore.QUrl('http://www.google.de/'))
def print_content():
print webview.page().mainFrame().toHtml()
QtCore.QObject.connect(webview, QtCore.SIGNAL('urlChanged(QUrl)'), print_content)
webview.show()
app.exec_()
Code: Alles auswählen
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title></head></html>