構造網頁顯示器, 在界面上顯示對應的網址內容
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_())