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 :-)<div><br></div>
<div>Thanks</div><div>Peter</div><div><br></div><div><div>from PyQt4.QtCore import *</div><div>from PyQt4.QtGui import *</div><div>import PyQt4.Qt as Qt</div><div>import sys</div><div><br></div><div>class Test(QMainWindow):</div>
<div> def __init__ (self, parent = None):</div><div> super(Test, self).__init__(parent)</div><div> self.frame = QFrame()</div><div> self.setCentralWidget(self.frame)</div><div> grid = QGridLayout()</div><div>
grid.addWidget(QLabel("Desc:"), 0, 0)</div><div> self.description = QTextEdit()</div><div> currentSize = self.description.size()</div><div> print currentSize</div><div> currentSize.scale(50,25, Qt.IgnoreAspectRatio)</div>
<div> self.description.resize(currentSize)</div><div> grid.addWidget(self.description, 0, 1)</div><div> self.frame.setLayout(grid)</div><div><br></div><div>if __name__ == '__main__':</div><div><br></div><div>
app = QApplication(sys.argv)</div><div><br></div><div> Gui = Test()</div><div> Gui.show()</div><div> app.exec_()</div></div>