pyqt5 web widget not open some website code example
Example: how to use QTWebkit in pyqt5
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QMainWindow, QApplication
from PyQt5.QtWebEngineWidgets import QWebEngineView
from flask import Flask, render_template, request
import threading
import sys
import os
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.setWindowTitle("Sorted Ware House")
self.setMinimumSize(900, 550)
self.path = os.getcwd()
self.path = self.path.replace('\\', '/')
self.browser = QWebEngineView()
self.browser.setUrl(QUrl(self.path+"/index.html"))
self.setCentralWidget(self.browser)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec_()