Hi, could anyone reproduce this problem and/or has a solution for it? Is there anything wrong with my code?
Best regards Ole Ole Streicher <ole-usenet-s...@gmx.net> writes: > 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 ------------------------------------------------------------------------------ Are you an open source citizen? Join us for the Open Source Bridge conference! Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. Need another reason to go? 24-hour hacker lounge. Register today! http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users