resizeable windows in pyqt

djw dwelch91 at no.spam.attbi.com
Sun Apr 13 18:24:38 EDT 2003


Tom Chance wrote:
> Hullo,
> 
> I know this sounds really daft, but I can't get my windows to be nicely
> resizeable in PyQt. I'm using Qt Designer to make the GUI, and I start with
> a MainWindow project, without any of the toolbars/menus (so a blank slate).
> I then add the various widgets in grids, and when I preview it, the window
> resizes but none of the widgets resize with it. I've set the sizePolicy as
> "preferred", and played around with other likely looking options, but I
> can't work it out! How do I do it?
> 
> Thanks,
> Tom
You need to layout your controls in the window using a layout control. 
Try this: with your window with all of its controls showing, click on 
the window itself (that is, not on any control). Then, click on the grid 
layout (block of 9 blue squares). Hit Ctrl-T and try it out: it should 
now resize the controls in the window as the window changes size. 
Understanding the layout controls (there are several others), is 
critical to successfully creating usable GUIs in Qt/PyQt. I would 
recommend that you take a look at one of the Qt programming books and/or 
online help.

/d/





More information about the Python-list mailing list