SourceForge logo
SourceForge logo
Menu

[matplotlib-devel] How to embed a matlibplot figure canvas into a pyqt4 GUI

From: Matthew A. <mat...@ya...> - 2014年12月02日 22:00:24
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

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /