Hi! I’m new with Streamlit, I’m wondering if it is possible to use Streamlit to send a notification (I’m using Jupyter notebook, however, it can be used in another tool such as Spyder or Pycharm) to a mobile. The idea is:
1- In JN, I’m running a code where an if-else statement notifies or not a given condition.
2- If the condition is true, I would like to show an alert (with a personalize graphical environment) to a given number of users to their mobile phones. I understand that the users might have the Streamlit app URL in their mobiles (as a Chrome, Firefox, etc. icon) but active.
3- When the user receives the notification with a given information, it should be displayed in their phones.
I don’t know if it is possible with Streamlit (freemium).
Hi @rex_perro, welcome to the Streamlit community!
I’m not sure I understand the use case here, but this doesn’t sound like a Streamlit functionality. If there is a Python package that sends phone notifications, it’s probably possible to do what you are intending (and possibly with a Streamlit GUI), but this isn’t something Streamlit supports out of the box.
Thanks. My idea is when a user enters a Streamlit URL (previously executed in python), receive an event (e.g. a text). For instance, the code below introduces a given background color whether i is odd or even. I would like to:
1- the background is green initially
2- if an event occurs, the background changes to red (and the user can receive a notification if he/she has the browser running in the background).
3- after the event, the square turns green
I also want to use this post to ask how can I clear the previous box color when a new image is triggered, in this case, the images goes one after the other. I want to clear the background at each iteration
```
import streamlit as st
from PIL import Image
import time
#from streamlit import caching
placeholder = st.empty()
st.header("Warning")
#image = Image.open("green.jpg")
for i in range(1, 1000):
if (i % 2) == 0:
#caching.clear_cache()
placeholder = st.empty()
#Image.empty()
image = Image.open("green.jpg")
st.image(image, use_column_width=True, output_format="jpg")
#print("{0} is Even number". format(num))
else:
#caching.clear_cache()
placeholder = st.empty()
#Image.empty()
image = Image.open("red.jpg")
st.image(image, use_column_width=True, output_format="jpg")
#print("{0} is Odd number". format(num))
time.sleep(10)
```
Like I said, if there’s a Python library that does this, it would be separate from Streamlit.
In your code, you are re-using placeholder by defining it inside your if statements, which is probably not what you want. You want to set placeholder to the value of your image using placeholder.image() not st.image
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.