I've setup a basic PyQt5 GUI window, with a QWebEngine web browser element in the centre, and I'd like a good way to go about setting up the following:
I'd like the web browser to show a local HTML file, and when you press a certain button on the page, it will call a python function, which will in turn update some content in the html.
this is what I've got so far; I've tried a lot of different methods but all of them seemed to be for PyQt4 and not using QWebEngine.
import sys, os
import PyQt5
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtWebEngineWidgets import *
class WindowC(PyQt5.QtWidgets.QMainWindow):
def __init__(self, *args, **kwargs):
super(WindowC,self).__init__(*args, **kwargs)
self.directory = os.getcwd()
self.browser = QWebEngineView()
self.setCentralWidget(self.browser)
local_url = QUrl.fromLocalFile( os.path.join( self.directory, "page.html" ) )
self.browser.load(local_url)
app = PyQt5.QtWidgets.QApplication(sys.argv)
window = WindowC()
window.show()
app.exec_()
Sorry if the question's a bit vague