Class MyOtherPanel inherits an instance variable called Sizer from wx.Panel. Your class overwrites whatever information wx is keeping in it.
It would probably be a good idea to start your instance variable names with a lower case letter to avoid clashes.
Regards,
--CMcP
···
On 14 Mar 2008, at 22:05, Tim Black wrote:
I have a wx.App that crashes upon laying out a window, and I can't figure out
what I'm doing wrong. Basically, I'd like to have a Static Box outline an entire
panel. Inside this static box I'd like to have a more complex control layout. So
I decided to use a wx.GridBagSizer for all the controls, and then stick that
inside a wx.StaticBoxSizer, and set the panel's sizer to the StaticBoxSizer. wx
crashes everytime I call the panel's SetSizer method, passing it the
StaticBoxSizer. Note that I am not using wx.StaticBoxSizer, but my own custom
StaticBoxSizer class. I've attached the app code below. The really strange thing
is that I have 2 panel classes that are almost identical, and creating one of
them (MyPanel) does not create a crash, but creating the other one
(MyOtherPanel) causes the crash. Let me know if you have any ideas what might be
going on here... FYI: I'm on win32, Python 2.5.2 (r252:60911, Feb 21 2008,
13:11:45), wx-2.8-msw-unicode.
Thanks,
Tim...
class MyOtherPanel(wx.Panel):
"""Creating one of these seems to crash wxPython."""
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
self.MainStaticBoxSizer = StaticBoxSizer(self, wx.HORIZONTAL,
label="MyOtherPanel" )
self.Sizer = wx.GridBagSizer(2, 2) # vgap, hgap
...