Update app.py
Browse files
app.py
CHANGED
@@ -37,8 +37,8 @@ def update_progress_circle(remaining_time, total_time, time_up=False):
|
|
37 |
|
38 |
if time_up:
|
39 |
# Show "Time's Up!" in the center of the circle
|
40 |
-
ax.pie([1], colors=['#6d8c9c'], startangle=90, counterclock=False, wedgeprops=dict(width=0.
|
41 |
-
ax.text(0, 0, "Time's Up!", fontsize=
|
42 |
else:
|
43 |
# Calculate the proportion of remaining time
|
44 |
fraction_completed = remaining_time / total_time if total_time > 0 else 0
|
@@ -46,7 +46,7 @@ def update_progress_circle(remaining_time, total_time, time_up=False):
|
|
46 |
|
47 |
# Format and add remaining time as text in the center of the circle
|
48 |
minutes, seconds = divmod(remaining_time, 60)
|
49 |
-
ax.text(0, 0, f"{int(minutes):02d}:{int(seconds):02d}", fontsize=
|
50 |
|
51 |
ax.set_aspect('equal')
|
52 |
return fig
|
@@ -116,7 +116,7 @@ if st.session_state.countdown_started and not st.session_state.time_up:
|
|
116 |
st.session_state.time_up = True
|
117 |
fig = update_progress_circle(0, st.session_state.start_time, time_up=True) # Add "Time's Up!" message
|
118 |
progress_placeholder.pyplot(fig)
|
119 |
-
countdown_placeholder.write("⏰ **Time's Up!**")
|
120 |
|
121 |
# Play the sound using Streamlit's audio player
|
122 |
audio_file = open("timesup.mp3", "rb")
|
|
|
37 |
|
38 |
if time_up:
|
39 |
# Show "Time's Up!" in the center of the circle
|
40 |
+
ax.pie([1], colors=['#6d8c9c'], startangle=90, counterclock=False, wedgeprops=dict(width=0.15))
|
41 |
+
ax.text(0, 0, "Time's Up!", fontsize=12, va='center', ha='center', color="gray") # "Time's Up!" message inside the circle
|
42 |
else:
|
43 |
# Calculate the proportion of remaining time
|
44 |
fraction_completed = remaining_time / total_time if total_time > 0 else 0
|
|
|
46 |
|
47 |
# Format and add remaining time as text in the center of the circle
|
48 |
minutes, seconds = divmod(remaining_time, 60)
|
49 |
+
ax.text(0, 0, f"{int(minutes):02d}:{int(seconds):02d}", fontsize=12, va='center', ha='center') # Remaining time
|
50 |
|
51 |
ax.set_aspect('equal')
|
52 |
return fig
|
|
|
116 |
st.session_state.time_up = True
|
117 |
fig = update_progress_circle(0, st.session_state.start_time, time_up=True) # Add "Time's Up!" message
|
118 |
progress_placeholder.pyplot(fig)
|
119 |
+
# countdown_placeholder.write("⏰ **Time's Up!**")
|
120 |
|
121 |
# Play the sound using Streamlit's audio player
|
122 |
audio_file = open("timesup.mp3", "rb")
|