Skip to content

Commit 4085d6b

Browse files
rlskoesertpike3
authored andcommitted
Add step count display to JupyterViz
1 parent 8353641 commit 4085d6b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

mesa/experimental/jupyter_viz.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,14 @@ def make_model():
181181
# 3. Buttons
182182
playing = solara.use_reactive(False)
183183

184+
# 4. Status indicators
185+
#: current round step count
186+
step = solara.use_reactive(False)
187+
184188
def on_value_play(change):
185189
if viz.model.running:
186190
viz.do_step()
191+
step.value = viz.model.schedule.steps
187192
else:
188193
playing.value = False
189194

@@ -207,6 +212,12 @@ def on_value_play(change):
207212
playing=playing.value,
208213
on_playing=playing.set,
209214
)
215+
widgets.IntText(
216+
value=step.value,
217+
description="Step:",
218+
disabled=True,
219+
interval=play_interval,
220+
)
210221
# threaded_do_play is not used for now because it
211222
# doesn't work in Google colab. We use
212223
# ipywidgets.Play until it is fixed. The threading

0 commit comments

Comments
 (0)