Hello, I'm trying to wire together a simple way to display status updates (in a text box) for the user to give them feedback about long-running simulations.
I thought I could do this using the "static_text" option of UserSettableParameter. But it appears that when I create such a text box, I am prohibited for some reason from passing it as an argument to the model constructor (so that the model could update the text while it's running.)
Minimum (non-)working example:
from mesa import Agent, Model
from mesa.visualization.UserParam import UserSettableParameter
from mesa.visualization.ModularVisualization import ModularServer
class MyModel(Model):
def __init__(self, in1, msg):
pass
def step(self):
pass
def run(self):
pass
if __name__ == "__main__":
in1 = UserSettableParameter("slider","Input",10,1,100,1)
msg = UserSettableParameter("static_text", value="<p>Boo</p>")
server = ModularServer(MyModel, [], "Broken", { "in1":in1, "msg":msg })
server.port = 8081
server.launch()
If "msg" is set to any other kind of UserSettableParameter (another slider, for example) this runs without error. As is, I get:
TypeError: __init__() missing 1 required positional argument: 'msg'
Lil help?