Hello everyone,
I’m having an unusual problem with wx.Notebook
under windows 2000. My application crashes any time it is started up with
only one page in the notebook that is on its main window. It crashes without
throwing an exception, the application just closes and the message “Python.exe
has generated errors and will be closed” is displayed. I’ve traced
this through in the debugger, and it appears that when a notebook containing
only one page is added to a sizer, and then SetSizerAndFit is called from
a panel with that sizer as its argument, the interpreter crashes. This
code runs correctly under Windows XP, the error appears to only occur under
Windows 2000. Here’s some sample code:
import wx
app = wx.PySimpleApp()
frame = wx.Frame(None)
panel = wx.Panel(frame, -1)
sizer = wx.BoxSizer(wx.VERTICAL)
nb = wx.Notebook(frame, -1, style=wx.NB_MULTILINE
wx.NB_NOPAGETHEME)
panel2 = wx.Panel(nb, -1)
panel3 = wx.Panel(nb, -1)
nb.AddPage(panel2, “Page 1”)
#nb.AddPage(panel3, “Page 2”)
#Uncomment this line and it works, comment it out and it crashes
sizer.Add(nb)
panel.SetSizerAndFit(sizer) #Crashes
here
Any ideas? Is this a real bug, or am
I doing something wrong?
Thanks,
–Matt