GetChildren()

hi to all,

I have a wx.StaticBoxSizer to which I add a series of objects of my panel

recovering the type of it with GetChildren() method in this way

children = panel.GetChildren()

for child in children:

if type(child) in( wx.Button,wx.StaticBitmap):

btnSizer.Add(child,0,wx.EXPAND|wx.ALL, 5)

with btnSizer that is a wx.StaticBoxSizer

I would to know how the sequence of loading is established by the cycle for.

This because in some frames the wx.Button objects appear (are .Add) before and wx.StaticBitmap later

while in other frame happens the contrary one.

regards

beppe

beppe wrote:

hi to all,
I have a wx.StaticBoxSizer to which I add a series of objects of my panel
recovering the type of it with GetChildren() method in this way

children = panel.GetChildren()
for child in children:
    if type(child) in( wx.Button,wx.StaticBitmap):
        btnSizer.Add(child,0,wx.EXPAND|wx.ALL, 5)

with btnSizer that is a wx.StaticBoxSizer

I would to know how the sequence of loading is established by the
cycle for.

There are no promises. To control the ordering, you need to add these
controls to the sizer as you create them.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

The order that children are in a window's children list is usually the order they were created. That order can be modified by changing the tab-order with the Move[Before|After]InTabOrder methods since that list is also when doing tab navigation.

···

On 7/31/12 8:19 AM, beppe wrote:

hi to all,
I have a wx.StaticBoxSizer to which I add a series of objects of my panel
recovering the type of it with GetChildren() method in this way

children = panel.GetChildren()
for child in children:
     if type(child) in( wx.Button,wx.StaticBitmap):
         btnSizer.Add(child,0,wx.EXPAND|wx.ALL, 5)

with btnSizer that is a wx.StaticBoxSizer

I would to know how the sequence of loading is established by the cycle
for.
This because in some frames the wx.Button objects appear (are .Add)
before and wx.StaticBitmap later
while in other frame happens the contrary one.

--
Robin Dunn
Software Craftsman

Alternatively you could use a list to define them and create them,
giving them the frame as a parent and then adding them to the sizer, e.g.:

Components = [("String 1", None), (None, "Bitmap1.bmp"), etc)]
for (Label, BmpFn) in Components:
    Component = None
    if BmpFn:
        Bmp = wx.Bitmap(BmpFn)
    if Label and BmpFn:
        Component = wx.BitmapButton(self.Frame, wx.ID_ANY, Label, Bmp)
    elif Label:
        Component = wx.Button(Label)
    elif BmpFn:
        Component = Bmp...

    if Component:
        size.Add(Component, ....)

Gadget/Steve

···

On 31/07/2012 5:24 PM, Tim Roberts wrote:

beppe wrote:

hi to all,
I have a wx.StaticBoxSizer to which I add a series of objects of my panel
recovering the type of it with GetChildren() method in this way

children = panel.GetChildren()
for child in children:
    if type(child) in( wx.Button,wx.StaticBitmap):
        btnSizer.Add(child,0,wx.EXPAND|wx.ALL, 5)

with btnSizer that is a wx.StaticBoxSizer

I would to know how the sequence of loading is established by the
cycle for.

There are no promises. To control the ordering, you need to add these
controls to the sizer as you create them.

beppe wrote:

hi to all,

I have a wx.StaticBoxSizer to which I add a series of objects of my panel
recovering the type of it with GetChildren() method in this way

children = panel.GetChildren()

for child in children:

if type(child) in( wx.Button,wx.StaticBitmap):
    btnSizer.Add(child,0,wx.EXPAND|wx.ALL, 5)

with btnSizer that is a wx.StaticBoxSizer

I would to know how the sequence of loading is established by the

cycle for.

There are no promises. To control the ordering, you need to add these

controls to the sizer as you create them.

right, it’s the same of tab order.

thanks,even to robin.

beppe

···

Il giorno martedì 31 luglio 2012 18:24:26 UTC+2, Tim Roberts ha scritto:


Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.