How to insert Streamlit app within pyqt5 software

Viewed 23

I want to insert streamlit dashboard inside the pyqt5 application local host URL within the python code. The problem is, every time I have to run the code and see the dashboard, I need to run the streamlit run app.py in command prompt. After running in the command prompt the dashboard is showing in the pyqt application.

Are there any alternate ways to stop using the command prompt.

Below is my code:

from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtWebEngineWidgets import *
import os
import subprocess
import sys

def dashboardUi(self):

    self.mainLayout = QVBoxLayout()

    dashboardcmd = "py -m streamlit run Dashboard2.py"
    jk = os.system(dashboardcmd)
   
    self.browserView = QWebEngineView()
    self.browserView.setUrl(QUrl("http://localhost:8501"))
    self.browserView.setUrl(QUrl("http://192.168.68.108:8501"))
    self.mainLayout.addWidget(self.browserView)
    self.setCentralWidget(self.browserView)
    

main = QWidget()
main.setLayout(self.mainLayout)
return main
0 Answers
Related