Sets or gets a parameter. Note the parameter must have been previously registered with Params.add()
.
Parameters
param — str|tuple, required
A parameter identification string or tuple. A string value indicates a global parameter or a
dict
of values for per-item parameters. Individual settings of per-breed or per-good parameters can be indicated with a two-item tuple,('paramName', 'goodName')
or('paramName', 'breedName')
.
If only this argument is set, the function returns the value of the named parameter.val — str|bool|num|list[str], optional
If this argument is set, the function sets the value of the parameter to
val
. The data type must be appropriate to the parameter type: a slider takes a number, a menu takes a string, a checkbox takes a bool, a checkentry takes a bool, a string, or an int, depending on the type, and a checkgrid takes a list of strings.
Note that per-item parameters can only be set on an individual basis; i.e. theval
argument will only be accepted for per-item parameters if the item is specified in theparam
argument with a tuple.Default value: None
Return Value — str|bool|num|dict|None
If val
is not set, returns the parameter value: a string if the parameter is a menu, a boolean if a checkbox, a number if a slider, a bool, int, or string if a checkentry, or a list of strings if a checkgrid. If a two-item tuple is passed for param
without specifying an item, the function returns a dict
with parameter values for all relevant items. If val
is set, the function sets the parameter to val
and does not return a value.
charwick
Mar 24, 2020 at 3:33This example doubles the value of the
'agentSpeed'
parameter.charwick
Jun 25, 2020 at 19:47A few examples to show the uses of the parameter identification pattern.