awacke1 commited on
Commit
eee3377
·
verified ·
1 Parent(s): 93bdd1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py CHANGED
@@ -22,6 +22,9 @@ REFRESH_RATE = 5
22
  INTERACTION_RADIUS = 2
23
  POINTS_PER_INTERACTION = 1
24
 
 
 
 
25
  # 🕒 Timer Management
26
  class GameTimer:
27
  def __init__(self):
@@ -332,6 +335,28 @@ def main():
332
  st.title("Multiplayer Tile Game")
333
  create_game_board()
334
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  # 🧹 Cleanup on exit
336
  def cleanup():
337
  if 'game_timer' in st.session_state:
@@ -340,5 +365,9 @@ def cleanup():
340
  # Register cleanup
341
  atexit.register(cleanup)
342
 
 
 
 
 
343
  if __name__ == "__main__":
344
  main()
 
22
  INTERACTION_RADIUS = 2
23
  POINTS_PER_INTERACTION = 1
24
 
25
+
26
+ from streamlit.components.v1 import html
27
+
28
  # 🕒 Timer Management
29
  class GameTimer:
30
  def __init__(self):
 
335
  st.title("Multiplayer Tile Game")
336
  create_game_board()
337
 
338
+
339
+
340
+ # Add this in your main() function, right after create_autorefresh()
341
+ # Add the time display component
342
+ st.markdown("""
343
+ <div id="time-display-root"></div>
344
+ """, unsafe_allow_html=True)
345
+
346
+ # Mount the React component
347
+ html("""
348
+ <div id="time-display-mount"></div>
349
+ <script>
350
+ const root = document.getElementById('time-display-root');
351
+ const mount = document.getElementById('time-display-mount');
352
+ if (root && mount) {
353
+ root.appendChild(mount);
354
+ }
355
+ </script>
356
+ """, height=200)
357
+
358
+
359
+
360
  # 🧹 Cleanup on exit
361
  def cleanup():
362
  if 'game_timer' in st.session_state:
 
365
  # Register cleanup
366
  atexit.register(cleanup)
367
 
368
+
369
+
370
+
371
+
372
  if __name__ == "__main__":
373
  main()