ParameterItem#

class pyqtgraph.parametertree.ParameterItem(
param,
depth=0,
)[source]#

Abstract ParameterTree item. Used to represent the state of a Parameter from within a ParameterTree.

  • Sets first column of item to name

  • generates context menu if item is renamable or removable

  • handles child added / removed events

  • provides virtual functions for handling changes from parameter

Subclasses that display a value widget may call makeCtrlButton() to add a ctrl button (gear icon) with a menu that exposes built-in actions (Reset to default, Set as default, Set Enabled/Set Disabled, Set ReadOnly/Set ReadWrite, Rename, Remove). Override populateCtrlMenu() to customise the menu.

For more ParameterItem types, see ParameterTree.parameterTypes module.

__init__(
param,
depth=0,
)[source]#
columnChangedEvent(
col,
)[source]#

Called when the text in a column has been edited (or otherwise changed). By default, we only use changes to column 0 to rename the parameter.

property defaultBtn#

Backward-compatible alias for ctrlBtn.

defaultChanged(
param,
default,
)[source]#

Called when the parameter’s default value has changed

focusNext(
forward=True,
)[source]#

Give focus to the next (or previous) focusable item in the parameter tree

isFocusable()[source]#

Return True if this item should be included in the tab-focus order

limitsChanged(
param,
limits,
)[source]#

Called when the parameter’s limits have changed

makeCtrlButton()[source]#

Create and return the ctrl CtrlButton.

Also sets self.ctrlBtn (and the self.defaultBtn alias) and self.ctrlMenu for use in populateCtrlMenu(). Call once during __init__ and add the returned widget to the layout.

makeDefaultButton()[source]#

Deprecated. Use makeCtrlButton() instead.

optsChanged(
param,
opts,
)[source]#

Called when any options are changed that are not name, value, default, or limits

populateCtrlMenu()[source]#

Rebuild the ctrl button menu to reflect current parameter state.

Override in a subclass to add custom entries; call super().populateCtrlMenu() to retain the built-in actions.

Which built-in actions appear is controlled by the ctrlActions parameter option (a set of strings, default DEFAULT_CTRL_ACTIONS). Valid values are 'default', 'setDefault', 'enabled', 'readonly', 'rename', and 'remove'. For 'rename' and 'remove', either including the key in ctrlActions or setting renamable=True / removable=True on the parameter is sufficient — both are treated as equivalent. 'context' actions always follow the context parameter option and are not controlled by ctrlActions.

selected(
sel,
)[source]#

Called when this item has been selected (sel=True) OR deselected (sel=False)

setFocus()[source]#

Give input focus to this item. Can be reimplemented to display editor widgets, etc.

treeWidgetChanged()[source]#

Called when this item is added or removed from a tree. Expansion, visibility, and column widgets must all be configured AFTER the item is added to a tree, not during __init__.

updateCtrlButton()[source]#

Refresh the ctrl button menu to reflect current parameter state.

Called automatically on value and opts changes. Override in a subclass to add custom refresh logic; call super().updateCtrlButton() to retain the built-in menu refresh.

When the menu is currently visible (e.g. a persistent action was just triggered), the rebuild is skipped — individual toggle actions update their own icon and text in-place, and aboutToShow ensures a full refresh the next time the menu opens.

updateDefaultBtn()[source]#

Deprecated. Use updateCtrlButton() instead.