wxPython layout problem

Tim Roberts timr at probo.com
Tue Jan 24 02:54:42 EST 2006


"py" <codecraig at gmail.com> wrote:
>
>I have the following code:
>...
>....there are two problems.
>1) i want the sizer (that is returned from buildTopPanel()) to fill the
>screen wide/tall.  now the text control in it is very small in the
>upper-left corner.
>
>2) the scroll bars and borders on the text controls dont appear until i
>mouse over them, any ideas?

The panel you create in buildTopPanel has not been added to any sizer.  So,
you have the odd condition that the self.text control is controlled by a
sizer, but its parent panel is not.  The layout is confused.

You need to build this up bit by bit.  The frame gets a panel.  The panel
is controlled by a sizer.  The panel will contain other panels, added to
the parent panel's sizer.  The inner panels may need their own sizers.  The
controls owned by the inner panels need to be added to the inner sizers.

The borders don't appear because parts of the panels are overlapping them
in strange ways.

Several folks have suggested that you create the controls from the outside
in, making sure that the control ownership is correct, and then as a
separate step, add those controls to sizers from the inside out.  That
works for me, but some kind of structure is needed to make sure that
ownership and sizership are handled completely.

You might try posting on the wxPython mailing list,
http://www.wxpython.org/maillist.php.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list