Built-in Parameter Types#

Parameters#

class pyqtgraph.parametertree.parameterTypes.ActionParameter(**opts)[source]#

Used for displaying a button within the tree.

sigActivated(self) is emitted when the button is clicked.

Parameters:
  • icon (str) – Icon to display in the button. Can be any argument accepted by QIcon.

  • shortcut (str) – Key sequence to use as a shortcut for the button. Note that this shortcut is associated with spawned parameters, i.e. the shortcut will only work when this parameter has an item in a tree that is visible. Can be set to any string accepted by QKeySequence.

itemClass#

alias of ActionParameterItem

class pyqtgraph.parametertree.parameterTypes.CalendarParameter(**opts)[source]#

Displays a Qt calendar whose date is specified by a ‘format’ option.

Options:

format

Format for displaying the date and converting from a string. Can be any value accepted by QDate.toString and fromString, or a stringified version of a QDateFormat enum, i.e. ‘ISODate’, ‘TextDate’ (default), etc.

class pyqtgraph.parametertree.parameterTypes.ChecklistParameter(**opts)[source]#

Can be set just like a ListParameter, but allows for multiple values to be selected simultaneously.

Options

exclusive

When False, any number of options can be selected. The resulting value() is a list of all checked values. When True, it behaves like a list type – only one value can be selected. If no values are selected and exclusive is set to True, the first available limit is selected. The return value of an exclusive checklist is a single value rather than a list with one element.

delay

Controls the wait time between editing the checkboxes/radio button children and firing a “value changed” signal. This allows users to edit multiple boxes at once for a single value update.

itemClass#

alias of ChecklistParameterItem

class pyqtgraph.parametertree.parameterTypes.ColorMapParameter(**opts)[source]#
itemClass#

alias of ColorMapParameterItem

class pyqtgraph.parametertree.parameterTypes.ColorParameter(**opts)[source]#
itemClass#

alias of ColorParameterItem

class pyqtgraph.parametertree.parameterTypes.FileParameter(**opts)[source]#

Interfaces with the myriad of file options available from a QFileDialog.

Note that the output can either be a single file string or list of files, depending on whether fileMode=’ExistingFiles’ is specified.

Note that in all cases, absolute file paths are returned unless relativeTo is specified as elaborated below.

Options:

parent

Dialog parent

winTitle

Title of dialog window

nameFilter

File filter as required by the Qt dialog

directory

Where in the file system to open this dialog

selectFile

File to preselect

relativeTo

Parent directory that, if provided, will be removed from the prefix of all returned paths. So, if ‘/my/text/file.txt’ was selected, and relativeTo=’my/text/’, the return value would be ‘file.txt’. This uses os.path.relpath under the hood, so expect that behavior.

kwargs

Any enum value accepted by a QFileDialog and its value. Values can be a string or list of strings, i.e. fileMode=’AnyFile’, options=[‘ShowDirsOnly’, ‘DontResolveSymlinks’]

class pyqtgraph.parametertree.parameterTypes.FontParameter(**opts)[source]#

Creates and controls a QFont value. Be careful when selecting options from the font dropdown. since not all fonts are available on all systems

class pyqtgraph.parametertree.parameterTypes.GroupParameter(**opts)[source]#

Group parameters are used mainly as a generic parent item that holds (and groups!) a set of child parameters.

It also provides a simple mechanism for displaying a button or combo that can be used to add new parameters to the group. To enable this, the group must be initialized with the ‘addText’ option (the text will be displayed on a button which, when clicked, will cause addNew() to be called). If the ‘addList’ option is specified as well, then a dropdown-list of addable items will be displayed instead of a button.

addNew(typ=None)[source]#

This method is called when the user has requested to add a new item to the group. By default, it emits sigAddNew(self, typ).

itemClass#

alias of GroupParameterItem

setAddList(vals)[source]#

Change the list of options available for the user to add to the group.

class pyqtgraph.parametertree.parameterTypes.ListParameter(**opts)[source]#

Parameter with a list of acceptable values.

By default, this parameter is represtented by a ListParameterItem, displaying a combo box to select a value from the list.

In addition to the generic Parameter options, this parameter type accepts a limits argument specifying the list of allowed values.

The values may generally be of any data type, as long as they can be represented as a string. If the string representation provided is undesirable, the values may be given as a dictionary mapping the desired string representation to the value.

itemClass#

alias of ListParameterItem

setLimits(limits)[source]#

Change the list of allowed values.

class pyqtgraph.parametertree.parameterTypes.PenParameter(**opts)[source]#

Controls the appearance of a QPen value.

When saveState is called, the value is encoded as (color, width, style, capStyle, joinStyle, cosmetic)

Options:

color

pen color, can be any argument accepted by mkColor() (defaults to black)

width

integer width >= 0 (defaults to 1)

style

String version of QPenStyle enum, i.e. ‘SolidLine’ (default), ‘DashLine’, etc.

capStyle

String version of QPenCapStyle enum, i.e. ‘SquareCap’ (default), ‘RoundCap’, etc.

joinStyle

String version of QPenJoinStyle enum, i.e. ‘BevelJoin’ (default), ‘RoundJoin’, etc.

cosmetic

Boolean, whether or not the pen is cosmetic (defaults to True)

mkPen(*args, **kwargs)[source]#

Thin wrapper around fn.mkPen which accepts the serialized state from saveState

static updateFromPen(param, pen)[source]#

Applies settings from a pen to either a Parameter or dict. The Parameter or dict must already be populated with the relevant keys that can be found in PenSelectorDialog.mkParam.

class pyqtgraph.parametertree.parameterTypes.ProgressBarParameter(**opts)[source]#

Displays a progress bar whose value can be set between 0 and 100

class pyqtgraph.parametertree.parameterTypes.SimpleParameter(**opts)[source]#

Parameter representing a single value.

This parameter is backed by WidgetParameterItem

to represent the following parameter names through various subclasses:

  • ‘int’

  • ‘float’

  • ‘bool’

  • ‘str’

  • ‘color’

  • ‘colormap’

class pyqtgraph.parametertree.parameterTypes.SliderParameter(**opts)[source]#

Options

limits

[start, stop] numbers

step:

Defaults to 1, the spacing between each slider tick

span:

Instead of limits + step, span can be set to specify the range of slider options (e.g. np.linspace(-pi, pi, 100))

format:

Format string to determine number of decimals to show, etc. Defaults to display based on span dtype

precision:

int number of decimals to keep for float tick spaces

class pyqtgraph.parametertree.parameterTypes.TextParameter(**opts)[source]#

Editable string, displayed as large text box in the tree.

itemClass#

alias of TextParameterItem

ParameterItems#

class pyqtgraph.parametertree.parameterTypes.ActionParameterItem(param, depth)[source]#

ParameterItem displaying a clickable button.

class pyqtgraph.parametertree.parameterTypes.BoolParameterItem(param, depth)[source]#

Registered parameter type which displays a QCheckBox

class pyqtgraph.parametertree.parameterTypes.CalendarParameterItem(param, depth)[source]#
class pyqtgraph.parametertree.parameterTypes.ChecklistParameterItem(param, depth)[source]#

Wraps a GroupParameterItem to manage bool parameter children. Also provides convenience buttons to select or clear all values at once. Note these conveniences are disabled when exclusive is True.

class pyqtgraph.parametertree.parameterTypes.ColorMapParameterItem(param, depth)[source]#

Registered parameter type which displays a GradientWidget

class pyqtgraph.parametertree.parameterTypes.ColorParameterItem(param, depth)[source]#

Registered parameter type which displays a ColorButton

class pyqtgraph.parametertree.parameterTypes.FileParameterItem(param, depth)[source]#
class pyqtgraph.parametertree.parameterTypes.FontParameterItem(param, depth)[source]#
class pyqtgraph.parametertree.parameterTypes.GroupParameterItem(param, depth)[source]#

Group parameters are used mainly as a generic parent item that holds (and groups!) a set of child parameters. It also provides a simple mechanism for displaying a button or combo that can be used to add new parameters to the group.

addChanged()[source]#

Called when “add new” combo is changed The parameter MUST have an ‘addNew’ method defined.

addClicked()[source]#

Called when “add new” button is clicked The parameter MUST have an ‘addNew’ method defined.

updateDepth(depth)[source]#

Change set the item font to bold and increase the font size on outermost groups.

class pyqtgraph.parametertree.parameterTypes.ListParameterItem(param, depth)[source]#

WidgetParameterItem subclass providing comboBox that lets the user select from a list of options.

class pyqtgraph.parametertree.parameterTypes.NumericParameterItem(param, depth)[source]#

Subclasses WidgetParameterItem to provide the following types:

Registered Types:

int

Displays a SpinBox in integer mode.

float

Displays a SpinBox.

class pyqtgraph.parametertree.parameterTypes.PenParameterItem(param, depth)[source]#
class pyqtgraph.parametertree.parameterTypes.ProgressBarParameterItem(param, depth)[source]#
class pyqtgraph.parametertree.parameterTypes.SliderParameterItem(param, depth)[source]#
class pyqtgraph.parametertree.parameterTypes.StrParameterItem(param, depth)[source]#

Registered parameter type which displays a QLineEdit

class pyqtgraph.parametertree.parameterTypes.TextParameterItem(param, depth)[source]#

ParameterItem displaying a QTextEdit widget.

class pyqtgraph.parametertree.parameterTypes.WidgetParameterItem(param, depth)[source]#

ParameterTree item with:

  • label in second column for displaying value

  • simple widget for editing value (displayed instead of label when item is selected)

  • button that resets value to default

This class can be subclassed by overriding makeWidget() to provide a custom widget.

limitsChanged(param, limits)[source]#

Called when the parameter’s limits have changed

makeWidget()[source]#

Return a single widget whose position in the tree is determined by the value of self.asSubItem. If True, it will be placed in the second tree column, and if False, the first tree column of a child item.

The widget must be given three attributes:

sigChanged

a signal that is emitted when the widget’s value is changed

value

a function that returns the value

setValue

a function that sets the value

This function must be overridden by a subclass.

optsChanged(param, opts)[source]#

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

selected(sel)[source]#

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

treeWidgetChanged()[source]#

Called when this item is added or removed from a tree.

updateDisplayLabel(value=None)[source]#

Update the display label to reflect the value of the parameter.

widgetValueChanging(*args)[source]#

Called when the widget’s value is changing, but not finalized. For example: editing text before pressing enter or changing focus.