Home >Backend Development >Python Tutorial >An introduction to how to make a simple browser using pyqt5 in python3
The following editor will bring you an example of using pyqt5 to create a super simple browser in python3. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.
We are using the QWebview module, and here we mainly show the usage of QWebview.
I spent a long time searching online to analyze the content of the web page, but it was not very clear.
This is the core code:
webview = Qwebview() webview.load(Qurl('http://www.cnblogs.com/Blaxon/')) webview.show()
The complete code (the code is Get other codes to change):
from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtWebKitWidgets import * class Form(QWidget): def __init__(self, parent=None): super(Form, self).__init__(parent) tmp = QWebView() buttonLayout1 = QVBoxLayout() buttonLayout1.addWidget(tmp) mainLayout = QGridLayout() mainLayout.addLayout(buttonLayout1,) self.setLayout(mainLayout) self.setWindowTitle("Hello Qt") tmp.load(QUrl('http://www.cnblogs.com/misoag/archive/2013/01/09/2853515.html')) tmp.show() if __name__ == '__main__': import sys app = QApplication(sys.argv) screen = Form() screen.show() sys.exit(app.exec_())
The above is the detailed content of An introduction to how to make a simple browser using pyqt5 in python3. For more information, please follow other related articles on the PHP Chinese website!