[wxPython-users] Re: how do I start PyCrust?

Robin Dunn robin at alldunn.com
Mon Jun 11 11:11:00 PDT 2007


7stud wrote:
> Thanks.  At first, I was a little confused by your various answers, but after
> doing some tests, I think I figured out how they fit together.  If someone 
> else stumbles upon this thread, the following is my understanding.  Please 
> correct me if I got something wrong.
> 
> If any window(a frame, a panel, a button, etc. are all windows) has a single
> child inside of it, then the child will expand to fill the window in response
> to an EVT_SIZE event.

Only frames and dialogs.


>  An EVT_SIZE event occurs when the window is initially
> displayed or when you call SendSizeEvent().  

Or when the user changes the size of a window, or if a call to SetSize 
actually causes the size to change.

> 
> Also, since a sizer is not a window, a single child(like a panel) inserted
> into a sizer won't automatically fill the sizer.  In fact, an empty panel
> shrinks to size 0,0.

Depends on platform.  I think wxMSW and wxGTK defaults to (20,20).


> 
> In the pycrust example, the frame was displayed on startup.  Subsequently,
> adding a panel to the frame did not cause the panel to fill the frame because
> no size event occurred *after* the panel was added to the frame.


Correct.


>  Instead,
> the added panel shrunk to size 0,0. 

It didn't actually shrink.  It was created at that size.


> Calling SetBackgroundColour() and 
> then calling Refresh() didn't work because the invisible panel was set to the
> color blue and then the panel was refreshed to redraw that change on the 
> panel, which meant that an invisible was redrawn in blue.

Correct.


> 
> If you call SendSizeEvent() instead of Refresh(), then the panel will expand
> to the size of the frame in response to EVT_SIZE, and the panel's blue color
> will then be visible.

Correct.


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





More information about the wxpython-users mailing list