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_())

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM