Hi, I am using matplotlib for some data vizualization. To ensure a consistent user interface among the whole application, I do the scrolling/zooming stuff myself. So, for a diagram, a horizontal scrollbar is displayed below the diagram that enabled to shift along the x axis. This is (part of) the code:
------------------------8<----------------------------------------------- from PyQt4 import QtGui, QtCore from matplotlib.figure import Figure,SubplotParams class DiagramWidget(QtGui.QWidget): def __init__(self, parent): QtGui.QWidget.__init__(self, parent) layout = QtGui.QVBoxLayout(self) self.diagram = InnerDiagramWidget(self) self.scrollbar = QtGui.QScrollBar(QtCore.Qt.Horizontal, self) self.connect(self.scrollbar, QtCore.SIGNAL('valueChanged(int)'), self.diagram.scroll_event) layout.addWidget(self.diagram) layout.addWidget(self.scrollbar) # ... class InnerDiagramWidget(FigureCanvas): def __init__(self, parent): fig = Figure(facecolor = 'w', subplotpars = SubplotParams(left = 0.08, right=0.96, bottom = 0.1, top=0.98)) self.axes = fig.add_subplot(111) FigureCanvas.__init__(self, fig) FigureCanvas.setParent(self, parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) def scroll_event(self, x): pass # here is real code ofcourse # ... ------------------------8<----------------------------------------------- However, when I put this DiagramWidget into a window and try to resize it vertically by mouse (with some data ... about 4000 points), the scrollbar is not alwas shown correctly. One can see that the diagram widget size does not change with every mouse move, and the scrollbar sometimes goes out of the visible window, where it is unusable. The similar occurres in the horizontal direction: sometimes the scrollbar gets not updated properly. This is the case when the Figure canvas takes a long time for update. If I put the scrollbar on top of the widget, everything is fine, except that is the wrong place for a scrollbar :-) Is this a bug in FigureCanvas, in Qt or in my code? How can I debug and solve this? Best regards Ole ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users