1from PyQt5.QtWidgets import (
2 QMainWindow,
3 QApplication
4)
5import sys
6
7
8class MainWindow(QMainWindow):
9 def __init__(self):
10 super(MainWindow, self).__init__()
11 self.setWindowTitle("Example of opening a webpage")
12 #Equivalent to initialize this web loading control
13 self.browser = QWebEngineView()
14 #Load external page, call
15 self.browser.load(QUrl("http://www.baidu.com"))
16 self.setCentraWidget(self.browser)
17
18
19if __name__=='__main__':
20 app = QApplication(sys.argv)
21 win = MainWindow()
22 win.show()
23 sys.exit(app.exec_())
24