First impressions of wxPython

Jeff Grimmett wrote:

Rick Muller wrote:

That being said, I'm doing something *boneheaded* in sizing widgets. For example, here's part of the widget I constructed to edit a check record:

[snip]

You're missing a call to make the sizer calculate its dimensions. For most panels, that would be

    self.vbox.Fit(self)

Until this is called, everything just kinda gets flopped onto the panel at random.

Not correct.

The Fit method calcualtes the min size needed to hold the items in the sizer and then resizes the window passed in (self) to that size. The resize event will call Layout which actually positions and sizes the items. If the panel is resized in some other way (manually, or because of its parent doing it, etc.) then Layout is called again. Or if your panel is already the size you want then you can call Layout yourself.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!