Hi Darren,

Darren Dale <dsdal...@gmail.com> writes:
> I am really busy with other things, and can't offer suggestions unless
> you post a short, simple, standalone script that demonstrates the
> problem.

Sure:
--------------------------------8<-----------------------------------------
import random
import sys

from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure,SubplotParams

class DiagramWidget(QtGui.QWidget):
    def __init__(self, parent):
        QtGui.QWidget.__init__(self, parent)
        layout = QtGui.QVBoxLayout(self)
        self.setLayout(layout)
        self.diagram = InnerDiagramWidget(self)
        self.scrollbar = QtGui.QScrollBar(QtCore.Qt.Horizontal, self)
        layout.addWidget(self.diagram)
        layout.addWidget(self.scrollbar)

    def resizeEvent(self, event):
        print 'figure resize to',  event.size()
        QtGui.QWidget.resizeEvent(self, event)

class InnerDiagramWidget(FigureCanvas):
    def __init__(self, parent):
        fig = Figure()
        self.axes = fig.add_subplot(111)
        range = xrange(10000)
        l = [ random.randint(-5, 5) for i in range ]
        self.axes.plot(range, l, drawstyle='steps')
        FigureCanvas.__init__(self, fig)
        self.setParent(parent)
        FigureCanvas.setSizePolicy(self,
                                   QtGui.QSizePolicy.Expanding,
                                   QtGui.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

    def resizeEvent(self, event):
        print 'scroll resize to',  event.size()
        FigureCanvas.resizeEvent(self, event)

a = QtGui.QApplication(sys.argv)
w = QtGui.QMainWindow()
w.setCentralWidget(DiagramWidget(w))
w.show()
a.exec_()
--------------------------------8<-----------------------------------------

To see the problem undisturbed, you may remove the "resizeEvent()"
functions.

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

Reply via email to