So my app needed to update every 10 to 20 seconds to see changes on a local file. I am using streamlit to process and visualise data from test equipment and I do not want the user to have to press the refresh button every time.
I tried st.experimental_rerun() and it is awesome for some things, but does not work in this case as it will just rerun endlessly.
My solution now is the following code:
from selenium import webdriver import time x = "http://localhost:8501/" refreshrate =10 refreshrate = int(refreshrate) driver = webdriver.Chrome(executable_path="C:\\Users\\z0044wmy\\Desktop\\chromedriver_win32\\chromedriver.exe") driver.get(url=x) while True: time.sleep(refreshrate) driver.refresh()
It requires download of the chrome driver: Downloads - ChromeDriver - WebDriver for Chrome
I cant say i love this solution, but it does work.
I can use Popen(‘refresher.py’, shell=True) to make sure this code runs in paralel.
A big downside is that lineedits are also refreshed mid-edit…
Anyone have any better ideas?