[PyQt] sizing a QTextEdit...

Peter Milliken peter.milliken at gmail.com
Thu Sep 9 04:03:14 BST 2010


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_()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100909/f3393ed3/attachment.html>


More information about the PyQt mailing list