[SciPy-dev] matplotlib and backend_qt

Nicolas Dumoulin n.dumoulin at arverne.homelinux.org
Thu Mar 16 05:19:40 EST 2006


Hi,

I'm new on this list.
I've discored matplotlib that allow to plot datas, and I'm particularely 
interested by the QT backend, for integrating plotting unctionnality in my 
scripts.

I've followed this tuto :
http://www.scipy.org/Wiki/Cookbook/Matplotlib/Qt_with_IPython_and_Designer
It is suitable for using in ipython but, I  would too make standalone scripts. 
So I've looked at the example examples/embedding_in_qt.py in the matplotlib 
archive, and read at the beginning :

-----------
[...]
# The QApplication has to be created before backend_qt is imported, otherwise
# it will create one itself.
# Note: color-intensive applications may require a different color allocation
# strategy.
QApplication.setColorSpec(QApplication.NormalColor)
app = QApplication(sys.argv)

from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as 
FigureCanvas
[...]
------------

It's annoying because I would make independant GUI compounds, and build my 
QApplication in the main script. To achieve this, I've hacked 
matplotlib/backends/backend_qt.py to comment 4 last lines that creates the 
(so annoying in my case) qt.QApplication, and it works fine.

I suppose that this QApplication is created to simplify the use of qt backend 
in ipython, doesn't it ?

My main questions are :
 * Couldn't be possible to modify this behaviour, for example by adding 
separated modules that enables QApplication creation for use in ipython ?
 * Have I missed something ?

If you aggree my reflexions, I could add a page to the Wiki/Cookbook to 
describe how I do ...

Thanks

-- 
Nicolas Dumoulin (french)
http://bobuse.webhop.net
http://eucd.info : sauvons le droit d'auteur ! 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20060316/a8fd6a8d/attachment.sig>


More information about the SciPy-Dev mailing list