{"id":31,"date":"2009-01-27T15:56:00","date_gmt":"2009-01-27T22:56:00","guid":{"rendered":"http:\/\/www.reisun.com\/?p=31"},"modified":"2009-01-27T15:56:00","modified_gmt":"2009-01-27T22:56:00","slug":"invalid-status-bar-field-index-in-wxpythonboa","status":"publish","type":"post","link":"https:\/\/www.reisun.com\/?p=31","title":{"rendered":"Invalid Status Bar Field Index in wxPython\/Boa"},"content":{"rendered":"<p>I had a very annoying bug in my wxPython application that I couldn&#8217;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:<\/p>\n<p>wx._core.PyAssertionError: C++ assertion &#8220;(number&gt;=0) &amp;&amp; (number &lt;m_nFields)&#8221; failed at ..\/src\/generic\/statusbr.cpp(142) in SetStatusText(): invalid status bar field index<\/p>\n<p>I use Boa Constructor to build my wxPython app, and in one of the generated code was the following:<\/p>\n<pre><\/pre>\n<pre>\u00c2\u00a0def _init_ctrls(self, prnt):\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 # generated method, don't edit\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 pos=wx.Point(503, 180), size=wx.Size(988, 660),\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 style=wx.DEFAULT_FRAME_STYLE, title=u'')\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 self._init_utils()\n        ...\n\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 self.SetStatusBarPane(3)<\/pre>\n<p>setting SetStatusBarPane(-1) disables automatic help text printing to the status bar, but also stops this very annoying bug.<\/p>\n<pre><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I had a very annoying bug in my wxPython application that I couldn&#8217;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 &#8220;(number&gt;=0) &amp;&amp; (number &lt;m_nFields)&#8221; failed at ..\/src\/generic\/statusbr.cpp(142) in SetStatusText(): invalid status bar field index I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/www.reisun.com\/index.php?rest_route=\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reisun.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reisun.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reisun.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reisun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=31"}],"version-history":[{"count":0,"href":"https:\/\/www.reisun.com\/index.php?rest_route=\/wp\/v2\/posts\/31\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.reisun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reisun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reisun.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}