Hi, Thanks a lot for your answer. I have tried with PySide 1.1.1, and indeed it works perfectly. I have also tried with PySide 1.0.9, and it works also! So this problem seems to appear only with PySide 1.1.0.
Regards, TP On Sunday, July 08, 2012 18:59:52 Lars Bittrich wrote: > Hi, > > for me it works flawlessly. However, I am using a newer version of > PySide on Ubuntu 12.04 with the pyside-ppa builds. > > Regards, > Lars > > In [1]: from PySide import QtCore > > In [2]: QtCore.qVersion() > Out[2]: '4.8.1' > > In [3]: from PySide import __version__ > > In [4]: __version__ > Out[4]: '1.1.1' > > In [5]: import matplotlib > > In [6]: matplotlib.__version__ > Out[6]: '1.1.1rc' > > > On Sat, 07 Jul 2012 11:34:55 +0200 > > TP <[email protected]> wrote: > > Hi everybody, > > > > I have just posted a question on the Matplotlib mailing list: > > > > http://sourceforge.net/mailarchive/forum.php?thread_name=4FF7A4D3.7060008% > > 40hawaii.edu&forum_name=matplotlib- users > > > > I obtain a segfault when using PySide, but not PyQt4. The answer obtained > > on the Matplotlib mailing list seems to point to a possible bug in > > PySide. > > > > For convenience, I have copied the Python script below at the end of this > > post. > > > > To test with PyQt4, use: > > $ python example.py > > > > To test with PySide: > > $ python example.py pyside > > > > With PySide, a segmentation fault appears as soon as the mouse cursor is > > hovering the plot area. Without the NavigationToolbar (try to comment the > > corresponding lines), the problem does not appear. It may be related to > > the > > display of mouse coordinates in the NavigationToolbar, because when the > > mouse is hovering the NavigationToolbar, no segfault appears. > > > > These are the versions of Qt, PySide, and Matplotlib on my machine: > > >>> from PySide import QtCore > > >>> QtCore.qVersion() > > > > '4.8.1' > > > > >>> from PySide import __version__ > > >>> __version__ > > > > '1.1.0' > > > > >>> import matplotlib > > >>> matplotlib.__version__ > > > > '1.1.1rc' > > > > Is this a bug in PySide? If yes, does any workaround exist? > > > > Thanks in advance, > > > > TP > > > > ########### example.py ############ > > #!/usr/bin/env python > > > > import sys > > > > if len(sys.argv) >= 2 and sys.argv[1] == "pyside": > > from os import environ > > environ['QT_API'] = 'pyside' > > > > from PySide.QtCore import * > > from PySide.QtGui import * > > > > else: > > from PyQt4.QtCore import * > > from PyQt4.QtGui import * > > > > from matplotlib.figure import Figure > > from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as > > FigureCanvas > > from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg > > > > class MplCanvasXY( FigureCanvas ): > > def __init__( self, title = None, xlabel = None, ylabel = None, > > > > parent=None ): > > self.fig = Figure() > > self.axes = self.fig.add_subplot(111) > > self.axes.grid(True) > > > > FigureCanvas.__init__( self, self.fig ) > > self.setParent( parent ) > > > > app = QApplication( sys.argv ) > > d = QDialog() > > > > vb = QVBoxLayout() > > canvas = MplCanvasXY() > > > > vb.addWidget( canvas ) > > navigationToolbar = NavigationToolbar2QTAgg( > > > > parent = canvas > > , canvas = canvas ) > > > > vb.addWidget( navigationToolbar ) > > d.setLayout( vb ) > > > > d.show() > > sys.exit( app.exec_() ) > > ############################## _______________________________________________ PySide mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/pyside
