Skip to content

Instantly share code, notes, and snippets.

@asehmi
Created April 19, 2022 13:54
Show Gist options
  • Save asehmi/34cdfe55077ee7ca5a4391ee69b4cb76 to your computer and use it in GitHub Desktop.
Save asehmi/34cdfe55077ee7ca5a4391ee69b4cb76 to your computer and use it in GitHub Desktop.
A simple Streamlit Pomodoro count down timer
import streamlit as st
import time
st.set_page_config(
page_title='Pomodoro',
layout='centered',
page_icon='🍅'
)
def count_down(ts):
with st.empty():
while True:
mins, secs = divmod(ts, 60)
time_now = '{:02d}:{:02d}'.format(mins, secs)
st.header(f"{time_now}")
time.sleep(1)
ts -= 1
if ts < 0:
break
st.write("Time Up!")
st.balloons()
def main():
st.title("Pomodoro")
time_minutes = st.number_input('Enter the time in minutes ', min_value=0.1, value=25.0)
time_in_seconds = time_minutes * 60
if st.button("START"):
count_down(int(time_in_seconds))
if __name__ == '__main__':
main()
@asehmi
Copy link
Author

asehmi commented Apr 19, 2022

pomodoro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment