The addmpl() method isn't right. You created a canvas object, assigned it
to self.canvas, but then tried to call FigureCanvas.__init__(), passing it
whatever object "self" is. What class is addmpl() a part of? What does it
subclass?
On Tue, Apr 21, 2015 at 7:24 AM, Christian Ambros <ambr...@ymail.com> wrote:
> Hi,
>
> I embedded Ryan's examble for PyQt5-matplotlib use into my App but I get
> the following error:
>
> /usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py:1009:
> UserWarning: Axes3D.figure.canvas is 'None', mouse rotation disabled. Set
> canvas then call Axes3D.mouse_init().
> warnings.warn('Axes3D.figure.canvas is \'None\', mouse rotation
> disabled. Set canvas then call Axes3D.mouse_init().')
>
> From Stackoverflow, which host to question about this, I know that mouse
> actions are disabled when the canvas is re-initialized by whatever.
>
> The only position I do such an operation is in here:
>
>
>
>
>
>
>
> *def addmpl(self, fig): self.canvas = FigureCanvas(fig)
> #FigureCanvas.__init__(self, fig) #Axes3D.mouse_init(self)
> self.mplvl.addWidget(self.canvas) self.canvas.draw()
> self.toolbar = NavigationToolbar(self.canvas, self.mplwindow,
> coordinates=True) self.mplvl.addWidget(self.toolbar)*
>
> On of the Stackoverflow suggestion says, that re initializing FigureCanvas
> should do the trick but I'll get:
>
> Traceback (most recent call last):
> File "./ex_0.1.py", line 145, in <module>
> main(sys.argv)
> File "./ex_0.1.py", line 53, in main
> mainwindow.addmpl(fig1)
> File "./ex_0.1.py", line 116, in addmpl
> FigureCanvas.__init__(self, fig)
> File
> "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5agg.py",
> line 181, in __init__
> FigureCanvasQT.__init__(self, figure)
> File
> "/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_qt5.py",
> line 237, in __init__
> super(FigureCanvasQT, self).__init__(figure=figure)
> TypeError: super(type, obj): obj must be an instance or subtype of type
>
> as follow-up error message.
>
> just using *Axes3D.mouse_init()* , as suggested by matplotlib itself,
> leads to:
>
> Traceback (most recent call last):
> File "./ex_0.1.py", line 146, in <module>
> main(sys.argv)
> File "./ex_0.1.py", line 53, in main
> mainwindow.addmpl(fig1)
> File "./ex_0.1.py", line 118, in addmpl
> Axes3D.mouse_init()
> TypeError: mouse_init() missing 1 required positional argument: 'self'
>
> adding self leads to:
>
> Traceback (most recent call last):
> File "./ex_0.1.py", line 146, in <module>
> main(sys.argv)
> File "./ex_0.1.py", line 53, in main
> mainwindow.addmpl(fig1)
> File "./ex_0.1.py", line 118, in addmpl
> Axes3D.mouse_init(self)
> File
> "/usr/local/lib/python3.4/dist-packages/mpl_toolkits/mplot3d/axes3d.py",
> line 1002, in mouse_init
> canv = self.figure.canvas
> AttributeError: 'Main' object has no attribute 'figure'
> ./ex_0.1.py &
>
> Maybe I'm adding those lines at the wrong place, but I could fined
> anything useful in the matplotlib documantation, that would help me out,
> either.
>
> Any thougts that might help?
>
> Cheers,
> Christian
>
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live
> exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users