简体   繁体   中英

How can you display Matplotlib objects in a GUI using qtdesigner?

I have attempted to integrate matplotlib figures into a GUI desined in qt designer and have not been able to get it to correctly integrate the two.

How would I go about promoting/altering/ect a QGraphicsView object into a canvas that can display a figure generated by matplotlib? This Example discusses EXACTLY what I'm struggling with but references using a matplotlibwidget, which doesn't exist in my version of Qtdesigner?

I've seen ways of designing the qtapplication window around a matplotlib canvas from scratch, but have not been able to take a qtdesigner built gui and implement matplotlib, since the objects are integrated in a more complicated manner when using the designer.

I tried to reproduce your issue regarding the example and indeed, when I ran the corresponding code from GitHub , I got the error:

ImportError: No module named 'matplotlibwidget'

The issue is that the MatplotLibWidget is part of the WinPython distribution and therefore only available out-of-the-box if you use WinPython.

I've found the source code of the MatplotlibWidget here . To make the examples work place it in a file called matplotlibwidget.py in the same directory as the example code.

Edit: I created an issue about it here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM