Skip to content

Qt4Agg: RuntimeError: call __init__ twice #5293

Closed

Description

@quazgar

With Matplotlib 1.5.0-rc2 (just installed by Debian testing), consider the following python session:

$ ipython3
Python 3.4.3+ (default, Oct 10 2015, 09:15:38)
Type "copyright", "credits" or "license" for more information.

IPython 2.3.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import matplotlib

In [2]: matplotlib.__version__
Out[2]: '1.5.0rc2'

In [3]: matplotlib.use("Qt4Agg")

In [4]: matplotlib.rcParams["backend.qt4"] = "PySide"

In [5]: from matplotlib.backends.backend_qt4agg import FigureCanvas

In [6]: from matplotlib.figure import Figure

In [7]: fig = Figure()

In [8]: canvas = FigureCanvas(fig)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-8-9faf89066fc2> in <module>()
----> 1 canvas = FigureCanvas(fig)

/usr/lib/python3/dist-packages/matplotlib/backends/backend_qt4agg.py in __init__(self, figure)
     70             print('FigureCanvasQtAgg: ', figure)
     71         FigureCanvasQT.__init__(self, figure)
---> 72         FigureCanvasQTAggBase.__init__(self, figure)
     73         FigureCanvasAgg.__init__(self, figure)
     74         self._drawRect = None

/usr/lib/python3/dist-packages/matplotlib/backends/backend_qt5agg.py in __init__(self, figure)
     63
     64     def __init__(self, figure):
---> 65         super(FigureCanvasQTAggBase, self).__init__(figure=figure)
     66         self._agg_draw_pending = False
     67

/usr/lib/python3/dist-packages/matplotlib/backends/backend_qt4.py in __init__(self, figure)
     69
     70         # Note different super-calling style to backend_qt5
---> 71         QtWidgets.QWidget.__init__(self)
     72         FigureCanvasBase.__init__(self, figure)
     73         self.figure = figure

RuntimeError: You can't initialize an object twice!

In [9]:

This code used to work fine with matplotlib 1.4.3 and now breaks.

Activity

  1. jenshnielsen commented on Oct 21, 2015

    @jenshnielsen
    Member

    Can you test whit the latest version of the 1.5.x branch. We have fixed a QT related issue since rc2

  2. tacaswell commented on Oct 24, 2015

    @tacaswell
    Member

    should be fixed by #5195

  3. tacaswell commented on Feb 15, 2016

    @tacaswell
    Member

    Closing as it should be fixed by #5195 which has been merged.

  4. added this to the v1.5.0 milestone on Feb 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions