I should be enough to use setMinimumSize: plot.setMinimumSize(10, 15) # for instance
Le mardi 3 mars 2015 21:38:37 UTC+1, Greg Nordin a écrit : > > After poking around some more I found a solution using the > setColumnStretch method of QGridLayout: > > # Example from http://www.pyqtgraph.org/documentation/qtcrashcourse.html > > from PyQt4 import QtGui # (the example applies equally well to PySide) > import pyqtgraph as pg > import pyqtgraph.opengl as gl > > ## Always start by initializing Qt (only once per application) > app = QtGui.QApplication([]) > > ## Define a top-level widget to hold everything > w = QtGui.QWidget() > w.resize(1000,600) > > ## Create some widgets to be placed inside > btn = QtGui.QPushButton('press me') > text = QtGui.QLineEdit('enter text') > listw = QtGui.QListWidget() > plot = gl.GLViewWidget() > plot.setSizePolicy(QtGui.QSizePolicy.Expanding, > QtGui.QSizePolicy.Expanding) > g = gl.GLGridItem() > #g.rotate(90,1,0,0) > plot.addItem(g) > > ## Create a grid layout to manage the widgets size and position > layout = QtGui.QGridLayout() > w.setLayout(layout) > layout.setColumnStretch (1, 2) > > ## Add widgets to the layout in their proper positions > layout.addWidget(btn, 0, 0) # button goes in upper-left > layout.addWidget(text, 1, 0) # text edit goes in middle-left > layout.addWidget(listw, 2, 0) # list widget goes in bottom-left > layout.addWidget(plot, 0, 1, 3, 1) # plot goes on right side, spanning 3 > rows > > ## Display the widget as a new window > w.show() > > ## Start the Qt event loop > app.exec_() > > -- You received this message because you are subscribed to the Google Groups "pyqtgraph" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/6ade0f76-c66a-4e3f-b167-c81c8df04258o%40googlegroups.com.
