from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import QWebEngineSettings, QWebEngineView, QWebEnginePage
from PyQt5.QtGui import QIcon
import PyQt5
import sys
class Main(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('Name')
self.setWindowIcon(QIcon('icon.png'))
web = QWebEngineView()
web.load(QUrl("https://google.com"))
web.page().toHtml(self.processHTML)
self.btn = QPushButton('Button', self)
self.btn.resize(self.btn.sizeHint())
lay = QVBoxLayout(self)
lay.addWidget(self.btn)
lay.addWidget(web)
def processHTML(html):
print(html)
app = QApplication(sys.argv)
main = Main()
main.show()
app.exec_()