Update app.py
Browse files
app.py
CHANGED
|
@@ -21,12 +21,12 @@ if "time_up" not in st.session_state:
|
|
| 21 |
st.title("🐧 MK316 Quiet Timer ⏳ ")
|
| 22 |
|
| 23 |
# Function to display the current time (as a live digital clock)
|
| 24 |
-
def display_current_time():
|
| 25 |
seoul_tz = pytz.timezone('Asia/Seoul') # Set timezone to Seoul
|
| 26 |
current_time = datetime.now(seoul_tz).strftime("%H:%M:%S") # Convert to Seoul time
|
| 27 |
|
| 28 |
# Style the clock (increase font size and set color)
|
| 29 |
-
|
| 30 |
f"<h1 style='text-align: center; font-size: 80px; color: #5785A4;'>{current_time}</h1>", # Large font
|
| 31 |
unsafe_allow_html=True
|
| 32 |
)
|
|
@@ -63,10 +63,9 @@ col1, col2 = st.columns([2, 1])
|
|
| 63 |
|
| 64 |
# Left column: Current time, input, buttons
|
| 65 |
with col1:
|
| 66 |
-
#
|
| 67 |
current_time_placeholder = st.empty()
|
| 68 |
-
|
| 69 |
-
|
| 70 |
# Buttons to Start and Reset the countdown
|
| 71 |
start_button, reset_button = st.columns([1, 1])
|
| 72 |
with start_button:
|
|
@@ -100,8 +99,8 @@ if st.session_state.countdown_started and not st.session_state.time_up:
|
|
| 100 |
# Sleep for a second
|
| 101 |
time.sleep(1)
|
| 102 |
|
| 103 |
-
# Update current time
|
| 104 |
-
display_current_time()
|
| 105 |
|
| 106 |
# When the countdown finishes
|
| 107 |
st.session_state.time_up = True
|
|
|
|
| 21 |
st.title("🐧 MK316 Quiet Timer ⏳ ")
|
| 22 |
|
| 23 |
# Function to display the current time (as a live digital clock)
|
| 24 |
+
def display_current_time(current_time_placeholder):
|
| 25 |
seoul_tz = pytz.timezone('Asia/Seoul') # Set timezone to Seoul
|
| 26 |
current_time = datetime.now(seoul_tz).strftime("%H:%M:%S") # Convert to Seoul time
|
| 27 |
|
| 28 |
# Style the clock (increase font size and set color)
|
| 29 |
+
current_time_placeholder.markdown(
|
| 30 |
f"<h1 style='text-align: center; font-size: 80px; color: #5785A4;'>{current_time}</h1>", # Large font
|
| 31 |
unsafe_allow_html=True
|
| 32 |
)
|
|
|
|
| 63 |
|
| 64 |
# Left column: Current time, input, buttons
|
| 65 |
with col1:
|
| 66 |
+
# Placeholder to display the current time
|
| 67 |
current_time_placeholder = st.empty()
|
| 68 |
+
|
|
|
|
| 69 |
# Buttons to Start and Reset the countdown
|
| 70 |
start_button, reset_button = st.columns([1, 1])
|
| 71 |
with start_button:
|
|
|
|
| 99 |
# Sleep for a second
|
| 100 |
time.sleep(1)
|
| 101 |
|
| 102 |
+
# Update current time in the placeholder
|
| 103 |
+
display_current_time(current_time_placeholder)
|
| 104 |
|
| 105 |
# When the countdown finishes
|
| 106 |
st.session_state.time_up = True
|