Why Does .Hide()ing and .Show()ing Panels in wxPython Result in the Sizer Changing the Layout?

前端 未结 2 1308
不思量自难忘°
不思量自难忘° 2021-02-03 10:08

As referenced in my previous question, I am trying to make something slightly wizard-like in function. I have settled on a single frame with a sizer added to it. I build panel

2条回答
  •  悲&欢浪女
    2021-02-03 10:37

    I think I figured it out. Instead of calls to the Show and Hide methods of the panels, you need to call the Show and Hide methods of the root sizer:

    self.Show()
    

    becomes

    self.GetParent().GetSizer().Show(self)
    

    ...and so on.

    Also, after each call, you need

    self.GetParent().GetSizer().Layout()
    

提交回复
热议问题