[PyQt] Self-adjusting QTextEdit (PyQt4)

Aaron Digulla digulla at hepe.com
Sat Apr 26 20:00:49 BST 2008

Wildemar Wildenburger schrieb:
> Hello folks,
> I'm trying to write a notecard application, somewhat in the vein of
> Evernote --- basically a succession of little textboxes, one per note,
> stacked above one another. To that end I'd like a QTextEdit (or similar)
> that adjusts its height (with given width) so that it always shows all
> its text, never more, never less.
> [...]
> This does not work as I hoped, naturally. :(
> How would I go about this?

The QTextEdit uses a scrollable area to display text, so the size policy
only changes the size of the scrollbars (i.e. the "frame" around the

Use QFont to find out what size the font is and then use this as a fixed
size for your editors.


Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://darkviews.blogspot.com/          http://www.pdark.de/

More information about the PyQt mailing list