-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstreamlit_app.py
More file actions
78 lines (70 loc) · 1.65 KB
/
streamlit_app.py
File metadata and controls
78 lines (70 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import streamlit as st
import time
from datetime import datetime
import pytz
st.markdown("""
<style>
html, body {
overflow: hidden !important;
height: 100% !important;
margin: 0 !important;
padding: 0 !important;
}
.time-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh !important;
width: 100vw !important;
position: fixed !important;
top: 0 !important;
left: 0 !important;
}
.big-time {
font-size: 20vw !important;
font-family: monospace;
line-height: 1;
white-space: nowrap;
margin: 0;
padding: 0;
}
.date-header {
font-size: 3vw !important;
margin-bottom: 2vh;
color: #666;
}
.timezone-label {
font-size: 2vw !important;
color: #888;
margin-top: 1vh;
}
.affiliate-label {
font-size: 3vw !important;
margin-bottom: 1vh;
color: #777;
}
</style>
""", unsafe_allow_html=True)
clock_container = st.empty()
hk_tz = pytz.timezone('Asia/Hong_Kong')
now = datetime.now(hk_tz)
current_time = now.strftime("%H:%M:%S")
current_date = now.strftime("%A, %B %d, %Y")
while True:
now = datetime.now(hk_tz)
current_time = now.strftime("%H:%M:%S")
if current_time == "00:00:00":
current_date = now.strftime("%A, %B %d, %Y")
time.sleep(1)
clock_container.markdown(
f"""
<div class="time-container">
<div class="date-header">{current_date}</div>
<div class="big-time">{current_time}</div>
<div class="timezone-label">Hong Kong Time (HKT)</div>
</div>
""",
unsafe_allow_html=True
)
time.sleep(1)