Get reference to all siblings

I can get a reference to all siblings using code like:

for window in self.GetParent().GetChildren():
  ...

... but how would I get the siblings of a parentless window,
such as a top-level Frame?

···

--
Paul

Paul McNett wrote:

I can get a reference to all siblings using code like:

for window in self.GetParent().GetChildren():
  ...

... but how would I get the siblings of a parentless window, such as a top-level Frame?

wxWidgets has a list of top-level windows, but it is not wrapped for wxPython yet. I'll add it to the list.

What are you needing to do? Perhaps there is another way to do it.

···

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

Robin Dunn writes:

wxWidgets has a list of top-level windows, but it is not
wrapped for wxPython yet. I'll add it to the list.

Cool.

What are you needing to do? Perhaps there is another way to
do it.

This is just to take care of an edge case in a framework I'm
working on, where I enforce unique object names among siblings.
When user code sets the name, I iterate through all siblings
and if there is already an object with the name I raise an
exception. My problem occurs when self.GetParent() returns
None.

···

--
Paul

Paul McNett wrote:

Robin Dunn writes:

What are you needing to do? Perhaps there is another way to
do it.

This is just to take care of an edge case in a framework I'm working on, where I enforce unique object names among siblings. When user code sets the name, I iterate through all siblings and if there is already an object with the name I raise an exception. My problem occurs when self.GetParent() returns None.

Perhaps your framework can keep its own (weakref) list of top-level windows until wxPython gives access to the built-in one?

···

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