咱們使用的是QWebview模塊,這裏也主要是展現下QWebview的用法。html
以前在網上找了半天的解析網頁的內容,都不是很清楚。python
這是核心代碼:web
webview = Qwebview() webview.load(Qurl('http://www.cnblogs.com/Blaxon/')) webview.show()
完整代碼(代碼是拿的別的代碼改得):app
1 from PyQt5.QtCore import * 2 from PyQt5.QtWidgets import * 3 from PyQt5.QtWebKitWidgets import * 4 5 6 class Form(QWidget): 7 def __init__(self, parent=None): 8 super(Form, self).__init__(parent) 9 10 tmp = QWebView() 11 12 buttonLayout1 = QVBoxLayout() 13 buttonLayout1.addWidget(tmp) 14 15 mainLayout = QGridLayout() 16 mainLayout.addLayout(buttonLayout1, 1, 1) 17 18 self.setLayout(mainLayout) 19 self.setWindowTitle("Hello Qt") 20 tmp.load(QUrl('http://www.cnblogs.com/misoag/archive/2013/01/09/2853515.html')) 21 tmp.show() 22 23 24 if __name__ == '__main__': 25 import sys 26 app = QApplication(sys.argv) 27 screen = Form() 28 screen.show() 29 sys.exit(app.exec_())