Integrating Streamlit live data display in the PyQt5 application

How to show the live data display in the Dashboard in the Python PyQt5 application?

Any idea to implement this

Thank you in advance…

Hello

I found something similar for pyside2, I don’t remember the origin.
Code.


import atexit
import subprocess as sp
import os

from PySide2 import QtCore, QtWebEngineWidgets, QtWidgets

def kill_server(p):
    if os.name == 'nt':
        # p.kill is not adequate
        sp.call(['taskkill', '/F', '/T', '/PID', str(p.pid)])
    elif os.name == 'posix':
        p.kill()
    else:
        pass

if __name__ == '__main__':
    os.chdir("D:/path folder")
    cmd = 'streamlit run app.py --server.headless=True'

    p = sp.Popen(cmd.split(), stdout=sp.DEVNULL)
    atexit.register(kill_server, p)

    hostname = 'localhost'
    port = 8501


    app = QtWidgets.QApplication()
    main_window = QtWidgets.QMainWindow()
    main_window.setWindowTitle("Aurore")
    view = QtWebEngineWidgets.QWebEngineView()

    view.load(QtCore.QUrl(f'http://{hostname}:{port}'))
    view.show()
    app.exec_()
1 Like

Thanks