First, thanks for PythonQt! It's been a lot of fun playing around with it and I look forward to (further) integrating it into my projects.
On that note, I've been trying to integrate matplotlib into a C++ Qt project. I'm able to plot by adding the following at the top of example.py in the PyScriptingConsole example
importsyssys.path.append("/usr/lib/pymodules/python2.6/matplotlib")# maybe others ...frompylabimport*t=arange(0.0,2.0,0.01)s=sin(2*pi*t)plot(t,s,linewidth=1.0)xlabel('time (s)')ylabel('voltage (mV)')title('About as simple as it gets, folks')grid(True)show()
but once I close the first plot new ones are no longer interactive. I'm new to python but my guess is that PythonQt's interpreter grabs the thread at that point and that the solution is to make MPL PythonQt aware - as expressed in this topic
which makes sense as, I understand it, PythonQt was started for MeVisLab. Is the modified backend available? Are there any plans to push it to MPL or PythonQt? If not is anyone interested in working on one?
In any case thanks for PythonQt!
Andy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Your test only works because PyQt or PySide are installed with your Python and the matplotlib backend uses those.
To make this work in a standalone application you will need a PythonQt backend.
MeVisLab 2.3 contains a matplotlib backend that was ported to PythonQt, by coincidence I did that port.
It is not implemented as a full backend of its own, just a patch that replaces calls to PyQt/PySide with PythonQt in the Qt4 backend.
I did not have time to clean it up and to provide it back to the matplotlib community. It is fully functional except for the figure options dialog.
You can get it by downloading MeVisLab 2.3 RC and going to
And you will need PythonQt 2.1 and wrappers generated for Qt 4.8 (or generate your own wrappers using pythonqt_generator), otherwise the backend will not work due to a missing QImage constructor.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To run the generator, you typically just have to build it and then you can run "pythonqt_generator" it without any extra arguments from within the "generator/" directory.
It will autodetect Qt's location and it will overwrite the files at generated_cpp.
There are various additional commandline options, but you typically don't need them.
The batch files are not required for the generator, I don't really know if they still work, they are left-overs of the original Qt Jambi generator, I think.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
First, thanks for PythonQt! It's been a lot of fun playing around with it and I look forward to (further) integrating it into my projects.
On that note, I've been trying to integrate matplotlib into a C++ Qt project. I'm able to plot by adding the following at the top of example.py in the PyScriptingConsole example
but once I close the first plot new ones are no longer interactive. I'm new to python but my guess is that PythonQt's interpreter grabs the thread at that point and that the solution is to make MPL PythonQt aware - as expressed in this topic
http://sourceforge.net/projects/pythonqt/forums/forum/631393/topic/3966540
After much googling I haven't been able to find anyone working on such a backend other than here
http://www.mevislab.de/docs/2.3/MeVisLab/Resources/Documentation/Publish/SDK/NewInMeVisLab2_3/ch01s07.html
which makes sense as, I understand it, PythonQt was started for MeVisLab. Is the modified backend available? Are there any plans to push it to MPL or PythonQt? If not is anyone interested in working on one?
In any case thanks for PythonQt!
Andy
Your test only works because PyQt or PySide are installed with your Python and the matplotlib backend uses those.
To make this work in a standalone application you will need a PythonQt backend.
MeVisLab 2.3 contains a matplotlib backend that was ported to PythonQt, by coincidence I did that port.
It is not implemented as a full backend of its own, just a patch that replaces calls to PyQt/PySide with PythonQt in the Qt4 backend.
I did not have time to clean it up and to provide it back to the matplotlib community. It is fully functional except for the figure options dialog.
You can get it by downloading MeVisLab 2.3 RC and going to
INSTALLDIR/Packages/MeVis/ThirdParty/Python/…/Libs/matplotlib/…
(or Libs/site-packages if you are downloading 2.3 Stable Release)
and taking the matplotlib/backends/ directory. You can diff that against your matplotlib version to see the changes.
regards,
Florian
And you will need PythonQt 2.1 and wrappers generated for Qt 4.8 (or generate your own wrappers using pythonqt_generator), otherwise the backend will not work due to a missing QImage constructor.
Thanks!
Sorry to disturb in this thread, but I have a question about running the pythonqt_generator.
which are the steps to follow?
I noticed that there are 2 more scripts in the generator folder: merge.sh and generate.sh in which order they are supposed to be launched?
many thanks
Tommaso
A it off-topic, but well…
To run the generator, you typically just have to build it and then you can run "pythonqt_generator" it without any extra arguments from within the "generator/" directory.
It will autodetect Qt's location and it will overwrite the files at generated_cpp.
There are various additional commandline options, but you typically don't need them.
The batch files are not required for the generator, I don't really know if they still work, they are left-overs of the original Qt Jambi generator, I think.