Why does sizer.GetChildren return SizerItems instead of widgets?

106 views
Skip to first unread message

Mike Driscoll

unread,
Aug 22, 2012, 9:24:17 AM8/22/12
to wxpytho...@googlegroups.com
Hi,

I was attempting to help someone on StackOverflow yesterday (see http://stackoverflow.com/q/12031522/393194) and they were trying to get the children of a BoxSizer using its GetChildren method. This returns a list of SizerItems instead of the actual widgets though. Is there a way to get the widgets like you do when you call a panel's GetChildren method?

- Mike

Cody

unread,
Aug 22, 2012, 9:32:32 AM8/22/12
to wxpytho...@googlegroups.com
Hi,
Because the 'children' of a sizer may not all be windows/widgets. They
may be other sizers, spacers, ect...

Each of the SizerItem's has a reference to the Window object it
manages if it has one. Use either the Window property or GetWindow
method.


Cody

Mike Driscoll

unread,
Aug 22, 2012, 10:32:16 AM8/22/12
to wxpytho...@googlegroups.com

GetWindow? I knew I should have tried that, but I figured that would just return the frame or panel. Thanks Cody!

- Mike
Reply all
Reply to author
Forward
0 new messages