Reference 〉Function

Helipad.addParameter( str name, str title, str type, str|bool|num|list dflt, dict|list opts = {}, bool runtime = True, func callback = None, str desc = None, func(name, model) getter = None, func(val, name, model) setter = None )

Registers a global parameter to be displayed in the control panel. Depending on the required data, possible parameter types include menus, sliders, checkboxes, checkentries, or checkgrids. The current value of the parameter can be retrieved with model.param().

Note: model.addBreedParam() and model.addGoodParam() alias model.addParameter() via several undocumented optional parameters. It is recommended to use these two other functions for adding per-breed and per-good parameters, rather than using addParameter() directly.

Parameters

  • name str, required

    A slug-type string to be used to refer back to the parameter in other functions.

  • title str, required

    The title of the parameter, to be displayed in the GUI.

  • type str, required

    What type of control to display. Possible values are 'menu', 'check', 'slider', 'checkentry', 'checkgrid', or 'hidden'.

  • dflt str|bool|num|list, required

    The default value of the parameter. A menu should have a string here, a check a boolean, a slider a number, a checkentry a bool, int, or string, and a checkgrid a list of strings.

  • opts dict|list, optional

    Options for the parameter type.

    • A slider should have a dict with keys 'low', 'high', and 'step', with numeric values, corresponding to the max and min values and the slider's increment. Alternatively opts can take a list of integers for a slider that slides over defined values.
    • A menu should have key-value pairs corresponding to menu items, with the key the value returned by the parameter, and the value the label displayed in the GUI.
    • A checkgrid takes either a list of strings, or a dict with a name-label pair to describe each check. The label can also be entered as a two-item tuple, with the label as the first item and the tooltip text as the second.
    • Checks, checkentries, or hidden parameters do not need an opts parameter.

    Default value: {}

  • runtime bool, optional

    Whether the parameter can be changed during the model's runtime. If set to False, the parameter will be disabled while the model is running.

    Default value: True

  • callback func, optional

    An optional function that will execute when the parameter changes. The function takes three arguments: model, the model object; var, the name of the parameter (the first argument of model.addParameter); and val, the new value of the parameter.

    Default value: None

  • desc str, optional

    A long description to display as a tooltip. Note that tooltips require PMW when using the Tkinter frontend.

    Default value: None

  • getter func(name, model), optional

    A function to replace the parameter's own getter with open-ended code. The function can return None in order to pass to the default getter.

    Default value: None

  • setter func(val, name, model), optional

    A function to replace the parameter's own setter with open-ended code. The function can return something besides None in order to pass to the default setter.

    Default value: None

Return Value Param

The newly created Param object.


Fatal error: Uncaught TypeError: Unsupported operand types: string - string in /home/dh_nzhxm7/helipad.dev/wp-content/themes/propeller/functions.php:200 Stack trace: #0 [internal function]: {closure}(Object(WP_Comment), Object(WP_Comment)) #1 /home/dh_nzhxm7/helipad.dev/wp-content/themes/propeller/functions.php(200): usort(Array, Object(Closure)) #2 /home/dh_nzhxm7/helipad.dev/wp-includes/class-wp-hook.php(294): {closure}(Array) #3 /home/dh_nzhxm7/helipad.dev/wp-includes/plugin.php(212): WP_Hook->apply_filters(Array, Array) #4 /home/dh_nzhxm7/helipad.dev/wp-includes/comment-template.php(1518): apply_filters('comments_array', Array, 98) #5 /home/dh_nzhxm7/helipad.dev/wp-content/themes/propeller/single-hook.php(64): comments_template() #6 /home/dh_nzhxm7/helipad.dev/wp-includes/template-loader.php(106): include('/home/dh_nzhxm7...') #7 /home/dh_nzhxm7/helipad.dev/wp-blog-header.php(19): require_once('/home/dh_nzhxm7...') #8 /home/dh_nzhxm7/helipad.dev/index.php(17): require('/home/dh_nzhxm7...') #9 {main} thrown in /home/dh_nzhxm7/helipad.dev/wp-content/themes/propeller/functions.php on line 200