Search code examples
pythonwxpythonwxwidgets

How do I close all MDIChildFrames that are in a MDIParentFrame?


How do I close all MDIChildFrames that are in a MDIParentFrame? Is there a built in function to do this?

frame = MyFrame(None) #MDIParentFrame
frame.Show()

child1 = MDIChildFrame(frame, "MDIChildFrame")
child1.Show()

Solution

  • You can try to get the client window through GetClientWindow() method, then get list of child windows for that client window through GetChildren(), iterate through this list, check whether child window is wxMDIChildFrame using IsKindOf() macro, if it returns true then call Close(). wxPython classes should have the same list of methods as C++ version.