[portland] Looking for wxPython help

Robin Dunn robin at alldunn.com
Sat Apr 19 19:18:48 CEST 2014


Rich Shepard wrote:
> On Fri, 18 Apr 2014, Robin Dunn wrote:
>
>> super() is a Python function that returns a proxy object that
>> delegates to to the parent class or a sibling class. Using it is not
>> strictly necessary to use it, but it can be handy especially in cases
>> of multiple inheritance where the next class in a call chain may not
>> be fully known at the time that a call is written.
>>
>> http://stackoverflow.com/questions/576169/understanding-python-super-and-init-methods
>>
>
> Robin,
>
> Thanks. I know there have been many changes in Python, wxWidgets, and
> wxPython over the years so I've been looking for current documentation that
> I can use for reference with current versions.

The Phoenix docs are the most up to date.  There are some differences 
between Phoenix and Classic, but probably close enough.

>
>> Are you using a sizer in the frame?
>
> Yes.
>
>> Does the frame have other child widgets?
>
> No.
>
>> If a frame has only one child then it will automatically resize it to
>> fit in the frame's client area by default. If it has more than one
>> child or if you want different behavior then you'll either need to
>> give it some help with a sizer, or explicitly manage the children's
>> layout in the frame's EVT_SIZE handler.

A semi-common problem that could could result in the layout failure you 
describe is if there is no size event after the sizer has been set.  If 
the frame was created with a fixed size and shown and then after the 
child widgets and sizers are added there is nothing that change the size 
of the frame, then there will be no initial size event and the sizer is 
not triggered.  In cases like this it is easiest to just do something 
like self.Layout() in the frame after all the content has been created 
and the sizers set.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org


More information about the Portland mailing list