其他分享
首页 > 其他分享> > PyQt5基础学习-QWebEngineView(构建网页显示器) 1.QWebEngineView().load(Qurl(加载对应的网址))

PyQt5基础学习-QWebEngineView(构建网页显示器) 1.QWebEngineView().load(Qurl(加载对应的网址))

作者:互联网

构造网页显示器, 在界面上显示对应的网址内容

WebEngineView.py

"""
用Web浏览器控件(QWebEngineView)显示网页
PyQt5和Web的交互技术
同时使用Python和Web开发程序, 混合开发

python + JavaScript + HTML5 + CSS

QWebEngineView()
"""
from PyQt5.QtWidgets import *
from PyQt5.QtCore import QTimer, QDateTime
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
import sys


class WebEngineView(QMainWindow):
    def __init__(self):
        super(WebEngineView, self).__init__()
        self.setWindowTitle("打开外部网页例子")
        self.setGeometry(5, 30, 1355, 730)

        self.browser = QWebEngineView()
        self.browser.load(QUrl("https://geekori.com"))
        self.setCentralWidget(self.browser)


if __name__ == "__main__":
    app = QApplication(sys.argv)
    main = WebEngineView()
    main.show()

    sys.exit(app.exec_())

 

标签:load,__,WebEngineView,Qurl,self,PyQt5,QWebEngineView,import
来源: https://www.cnblogs.com/hyq-lst/p/15865066.html