Probably not. The code snippet might be a bad example. I am attempting to create a QFrame in the MainWindow and populate it with a number of pairs of lQLabel/QLineEdit. One of the "pairs" needs to be a QLabel/QTextEdit and unfortunately as soon as I add that the grid seems to 'explode' - in the vertical direction. I just want a QTextEdit sized about 3 or 4 times the height of a QLineEdit.
Thanks for the suggestion Peter On Thu, Sep 9, 2010 at 1:58 PM, Algis Kabaila <[email protected]> wrote: > On Thursday 09 September 2010 13:03:14 Peter Milliken wrote: > > I cannot work out how to (re)size a QTextEdit widget. I have tried > various > > methods, without success. I show one method in the following code > snippet, > > I would appreciate it if somebody could point out my error :-) > > > > Thanks > > Peter > > > > from PyQt4.QtCore import * > > from PyQt4.QtGui import * > > import PyQt4.Qt as Qt > > import sys > > > > class Test(QMainWindow): > > def __init__ (self, parent = None): > > super(Test, self).__init__(parent) > > self.frame = QFrame() > > self.setCentralWidget(self.frame) > > grid = QGridLayout() > > grid.addWidget(QLabel("Desc:"), 0, 0) > > self.description = QTextEdit() > > currentSize = self.description.size() > > print currentSize > > currentSize.scale(50,25, Qt.IgnoreAspectRatio) > > self.description.resize(currentSize) > > grid.addWidget(self.description, 0, 1) > > self.frame.setLayout(grid) > > > > if __name__ == '__main__': > > > > app = QApplication(sys.argv) > > > > Gui = Test() > > Gui.show() > > app.exec_() > > Would the following satisfy your immediate needs? > > from PyQt4.QtGui import * > import PyQt4.Qt as Qt > import sys > > class Test(QMainWindow): > def __init__ (self, parent = None): > super(Test, self).__init__(parent) > self.resize(600, 300) # Added statement > self.frame = QFrame() > self.setCentralWidget(self.frame) > grid = QGridLayout() > grid.addWidget(QLabel("Desc:"), 0, 0) > self.description = QTextEdit() > currentSize = self.description.size() > # print currentSize > # currentSize.scale(50,25, Qt.IgnoreAspectRatio) > self.description.resize(currentSize) > grid.addWidget(self.description, 0, 1) > self.frame.setLayout(grid) > if __name__ == '__main__': > app = QApplication(sys.argv) > Gui = Test() > Gui.show() > app.exec_() > > -- > OldAl > [email protected] >
_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
