I was having problems where a wx.ScrolledWindow was not showing scroll bars (this is with wx 2.8.10.1 running on a Mac). The problem was fixed by changing this:
win.DestroyChildren()
to this:
if win.GetSizer(): win.GetSizer().Clear(True)
in the routine that filled the contents of the ScrolledWindow. I have a feeling that this may be platform-specific behavior.
I did a fair amount of review of documentation etc. and did not find anything that says “don’t use DestroyChildren with ScrolledWindow” so I wanted to get this down here to perhaps save someone else some time.
I was having problems where a wx.ScrolledWindow was not showing scroll
bars (this is with wx 2.8.10.1 running on a Mac). The problem was fixed
by changing this:
win.DestroyChildren()
to this:
if win.GetSizer(): win.GetSizer().Clear(True)
in the routine that filled the contents of the ScrolledWindow. I have a
feeling that this may be platform-specific behavior.
I did a fair amount of review of documentation etc. and did not find
anything that says "don't use DestroyChildren with ScrolledWindow" so I
wanted to get this down here to perhaps save someone else some time.
Yes, on the Mac the scrollbars used on wx.ScrolledWindow are wx.ScrollBars and are mostly normal children of the window. On the other platforms the scrollbars are implemented by the native window and so we don't see them as normal children of the scrolled window. There is a method you can use to determine if a child is one of the special scrollbars, MacIsWindowScrollbar.