[PyQt] Help on resizing a custom widget

David Boddie david at boddie.org.uk
Mon Aug 27 23:27:11 BST 2007


On Mon Aug 27 19:53:30 BST 2007, skawaii wrote:

> Ok, here's what's going on. I've just created a custom widget. it works
> great. I'm having some trouble, however, figuring out how to allow the said
> widget to resize. For example, when I throw the widget into a new dialog
> (using Qt Designer), I want to be able to drag it larger/smaller and have

Where "it" is the dialog?

> widget expand/shrink to that size. Right now, I can drag the widget
> bigger/smaller all I want, but it doesn't actually change size.

It sounds like you have a widget in a dialog, but you're not using a
layout manager, so nothing is resizing the widget. I wrote a tutorial
for EuroPython last year that covered the basic principles of PyQt:

http://indico.cern.ch/contributionDisplay.py?contribId=33&sessionId=41&confId=44

You might find it useful. The Qt documentation also covers the basics, though
you'll need to translate from C++ as you go:

  http://doc.trolltech.com/4.3/layout.html

> I'm pretty new to PyQt (and therefore, Qt), so I'm pretty sure that the
> answer is a property that needs to be set somewhere. I'm just not sure which
> one. So you know, I'm using Python 2.4.3 and PyQt 3.1.6.

Newcomers to PyQt who prefer printed materials should note that a book on
PyQt programming will be available in the near future:

  http://qtrac.eu/pyqtbook.html

Though, of course, the documentation should be the first place any new
developer should look. ;-)

David


More information about the PyQt mailing list