Skip to content

Commit

Permalink
Add an option to disable drawing agent space projectmesa#1778
Browse files Browse the repository at this point in the history
  • Loading branch information
rlskoeser committed Aug 30, 2023
1 parent 79bde5a commit a86f51c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion mesa/experimental/jupyter_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ def make_user_input(user_input, k, v):

@solara.component
def MesaComponent(viz, space_drawer=None, play_interval=400):
"""Initialize a component to display a mesa simuliation.
Args:
viz: a component, as returned by :meth:`JupyterViz`
space_drawer: optional method to render the agent space for
the model; if not specified, will call :meth:`make_space`
to render; simulations with no space to visualize should
specify `space_drawer=False`
play_interval: play interval (default: 400)
"""
solara.Markdown(viz.name)

# 1. User inputs
Expand Down Expand Up @@ -219,7 +229,10 @@ def on_value_play(change):

with solara.GridFixed(columns=2):
# 4. Space
if space_drawer is None:
if space_drawer is False:
# if space drawer is disabled, do nothing
pass
elif space_drawer is None:
make_space(viz)
else:
space_drawer(viz)
Expand Down

0 comments on commit a86f51c

Please sign in to comment.