Answers for "pyqt5 load website"

0

pyqt5 load website

from PyQt5.QtWidgets import (
	QMainWindow, 
	QApplication
)
import sys


class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setWindowTitle("Example of opening a webpage")
        #Equivalent to initialize this web loading control
        self.browser = QWebEngineView()
        #Load external page, call
        self.browser.load(QUrl("http://www.baidu.com"))
        self.setCentraWidget(self.browser)
        
        
if __name__=='__main__':
    app = QApplication(sys.argv)
    win = MainWindow()
    win.show()
    sys.exit(app.exec_())
Posted by: Guest on July-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language