Matplotlib: Qt4agg Toolbar's Irritating Bug
Solution 1:
This does indeed seem to be a bug in the Qt4 form editor for matplotlib.
The error appears to be within a section of the FormWidget.setup()
method, in matplotlib/backends/qt4_editor/formwidget.py
. In matplotlib 1.1.0 on Windows (where I couldn't reproduce the problem), it contains the following:
elifisinstance(value, (list, tuple)):
selindex = value.pop(0)
field = QComboBox(self)
ifisinstance(value[0], (list, tuple)):
keys = [ key for key, _val in value ]
value = [ val for _key, val in value ]
else:
keys = value
field.addItems(value)
matplotlib v1.1.1rc on Kubuntu Precise (where I could reproduce the problem) replaces the second line of the above with
selindex = list(value).pop(0)
Ultimately, neither version is correct.
The problem with the version 1.1.0 method is that it doesn't handle tuples (tuples are immutable and don't have a pop
) method, and the problem with the version 1.1.1rc code is that the first element of value
is supposed to be removed, but it only gets removed from the temporary list that list(value)
creates.
This bug is fixed in version 1.1.1. I've just downloaded and installed this version and can no longer reproduce the problem.
Post a Comment for "Matplotlib: Qt4agg Toolbar's Irritating Bug"