Hi,
I’ve used Qt Designer to construct a GUI. An element of the GUI is a QGridLayout. I’ve been trying to display a matplotlib plot in this QGridLayout. I’m new at Python and have been trying to figure this out for the last week without success. Essentially I’m trying to use elements of the example shown here:
user_interfaces example code: embedding_in_qt4.py — Matplotlib 1.4.2 documentation
in my code shown here:
http://paste.ofcode.org/JA2Hm8cP4jYD4c9NXgVGaE
Lines 23-25 is the problem area. The error I get now is:
RuntimeError: super-class init() of type MyStaticMplCanvas was never called
Conceptually what I think I’m doing is:
Line 24 Create an object of type MyStaticMplCanvas called thePlot. This object is essentially a QWidget.
thePlot = MyStaticMplCanvas(self.main_widget)
Line 25 Pass thePlot as an argument to the addWidget method of the gridLayout I created in Qt Designer.
self.ui.gridLayout.addWidget(thePlot)
Thx for the help. I’ve spent about twenty hour trying to figure out this myself. Any help you can give me would be great!
Matt
I think line 102 is your problem. self.axes doesn’t exist yet.
Ben Root
P.S. - <shameless_plug>stuff like this will be covered in my upcoming book. I am wrapping up with the embedding chapter tonight, even! Stay tuned for announcements in the coming weeks.</shameless_plug>
···
On Tue, Dec 2, 2014 at 5:00 PM, Matthew Albert <matthewa927@…42…> wrote:
Hi,
I’ve used Qt Designer to construct a GUI. An element of the GUI is a QGridLayout. I’ve been trying to display a matplotlib plot in this QGridLayout. I’m new at Python and have been trying to figure this out for the last week without success. Essentially I’m trying to use elements of the example shown here:
user_interfaces example code: embedding_in_qt4.py — Matplotlib 1.4.2 documentation
in my code shown here:
http://paste.ofcode.org/JA2Hm8cP4jYD4c9NXgVGaE
Lines 23-25 is the problem area. The error I get now is:
RuntimeError: super-class init() of type MyStaticMplCanvas was never called
Conceptually what I think I’m doing is:
Line 24 Create an object of type MyStaticMplCanvas called thePlot. This object is essentially a QWidget.
thePlot = MyStaticMplCanvas(self.main_widget)
Line 25 Pass thePlot as an argument to the addWidget method of the gridLayout I created in Qt Designer.
self.ui.gridLayout.addWidget(thePlot)
Thx for the help. I’ve spent about twenty hour trying to figure out this myself. Any help you can give me would be great!
Matt
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel