I want to insert streamlit dashboard inside the pyqt5 application local host URL within the python code.
The problem is, every time if 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.
Is there any alternate ways to stop using command prompt.
I used ‘subprocess’ and ‘os’ module also. But its only executing streamlit run command and Dashboard is opening in local browser and stopping.
My requirement is first streamlit run command has to execute and after that automatically dashboard has to display in the pyqt5 window.
Anybody who knows the solution. Please help me on this.
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
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.