Source = ColumnDataSource(data=dict(x=x, y=y)) I built a small pyqt5 app as a minimal reproducible example: import sysįrom PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayoutįrom PyQt5.QtWebEngineWidgets import QWebEngineViewįrom bokeh.models import ColumnDataSource, CustomJS, Sliderįrom otting import Figure, output_file Self.ui.Vlayout_network.addWidget(self.m_output) # browser in widgetĪny clue about what I could do in order to properly show the HTML file?
Local_js_library_3 = omLocalFile(js_library_3).toString()įinal_html += ''.format(local_js_library_1)įinal_html += ''.format(local_js_library_2)įinal_html += ''.format(local_js_library_3) Local_js_library_2 = omLocalFile(js_library_2).toString() Local_js_library_1 = omLocalFile(js_library_1).toString() Js_library_3 = QDir.current().filePath("lib/Network/bokeh_js/bokeh-widgets-2.2.3.min.js") Js_library_2 = QDir.current().filePath("lib/Network/bokeh_js/bokeh-tables-2.2.3.min.js") Js_library_1 = QDir.current().filePath("lib/Network/bokeh_js/bokeh-2.2.3.min.js") # paths to the downloaded javascript libraries Html_file = Bgf.plot_bokeh(my_variables) #function that creates the Bokeh HTML file self.m_output = QtWebEngineWidgets.QWebEngineView() I tried going to those URLs and downloading manually those libraries and here's my final attempt, based on this answer. The HTML file is too big to show here but here's the required libraries:
#Html executable 4 disable printing download
Page = WebEnginePage(self.m_output) # class webenginepage required for download signals
Self.ui.Vlayout_network.addWidget(self.m_output) # put the browser in the PyQt5 widget Html_file = Bgf.plot_bokeh(my_data) #function that creates the Bokeh HTML file
#Html executable 4 disable printing code
So first of all, here's a snippet of my code that works in my IDE: self.m_output = QtWebEngineWidgets.QWebEngineView() I tried a whole lot of things so far including using both CDN and INLINE options when building the HTML, adding ("-disable-web-security") to my code, and downloading manually the javascript libraries needed in the HTML file (although im not sure I did it correctly). I don't know much about HTML but I suspect the issue is linked with QtWebEngine's inability to execute script tags in HTML files (even though it works flawlessly when I run it in my IDE?). This text goes on and on with my non-interactive graph shown in the middle of it all. The HTML still work when I open it manually with a web browser but QtWebBrowser outputs this: The issue arises when I build the executable with PyInstaller. I have managed to show this HTML file inside a PyQt5 widget through QtWebEngine and everything works as it should when run through my IDE. I am developing a feature that consist of creating a Bokeh graph with interactive widgets and tables (including javascript code), that are then exported as an HTML file.