Invalid Status Bar Field Index in wxPython/Boa

I had a very annoying bug in my wxPython application that I couldn’t figure out. In a GUI application that has a status bar and a context menu, any call to self.PopupMenu(mnu) would result in the following:

wx._core.PyAssertionError: C++ assertion “(number>=0) && (number <m_nFields)” failed at ../src/generic/statusbr.cpp(142) in SetStatusText(): invalid status bar field index

I use Boa Constructor to build my wxPython app, and in one of the generated code was the following:


 def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(503, 180), size=wx.Size(988, 660),
              style=wx.DEFAULT_FRAME_STYLE, title=u'')
        self._init_utils()
        ...
        self.SetStatusBarPane(3)

setting SetStatusBarPane(-1) disables automatic help text printing to the status bar, but also stops this very annoying bug.


						

Comments are closed.