TreeCtrl_EnsureVisible assert. Why?

I have update wxPython to 2.8.12.1 on Mac OS X Lion for Python.org 2.7.
Now I am seeing an assert that was not there on older versions of wxPython.

File "/Users/barry/wc/svn/pysvn/WorkBench/Source/wb_tree_panel.py", line 270, in initTree
    self.tree_ctrl.EnsureVisible( first_item )
  File "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_controls.py", line 5530, in EnsureVisible
    return _controls_.TreeCtrl_EnsureVisible(*args, **kwargs)
PyAssertionError: C++ assertion "m_heightText != -1" failed at /BUILD/wxPython-src-2.8.12.1/src/generic/treectlg.cpp(201) in GetTextHeight(): must call CalculateSize() first

Is this a bug in wxPython or do I have a new condition to check for before calling EnsureVisible?

The fragment of code leading up to this is:

        if first_item:
            self.tree_ctrl.SelectItem( first_item )
            self.tree_ctrl.EnsureVisible( first_item )

Barry

What is the current state of the treectrl at that point? For example, has it been shown and painted at least once? I assume from the above that it has items, how many? Enough to need to be scrolled? If you can duplicate the problem in a small sample I can take a closer look at what is going on.

···

On 11/11/11 12:07 PM, Barry Scott wrote:

I have update wxPython to 2.8.12.1 on Mac OS X Lion for Python.org 2.7.
Now I am seeing an assert that was not there on older versions of wxPython.

  File "/Users/barry/wc/svn/pysvn/WorkBench/Source/wb_tree_panel.py", line 270, in initTree
     self.tree_ctrl.EnsureVisible( first_item )
   File "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_controls.py", line 5530, in EnsureVisible
     return _controls_.TreeCtrl_EnsureVisible(*args, **kwargs)
PyAssertionError: C++ assertion "m_heightText != -1" failed at /BUILD/wxPython-src-2.8.12.1/src/generic/treectlg.cpp(201) in GetTextHeight(): must call CalculateSize() first

Is this a bug in wxPython or do I have a new condition to check for before calling EnsureVisible?

The fragment of code leading up to this is:

         if first_item:
             self.tree_ctrl.SelectItem( first_item )
             self.tree_ctrl.EnsureVisible( first_item )

--
Robin Dunn
Software Craftsman

I have update wxPython to 2.8.12.1 on Mac OS X Lion for Python.org 2.7.
Now I am seeing an assert that was not there on older versions of wxPython.

File "/Users/barry/wc/svn/pysvn/WorkBench/Source/wb_tree_panel.py", line 270, in initTree
    self.tree_ctrl.EnsureVisible( first_item )
  File "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_controls.py", line 5530, in EnsureVisible
    return _controls_.TreeCtrl_EnsureVisible(*args, **kwargs)
PyAssertionError: C++ assertion "m_heightText != -1" failed at /BUILD/wxPython-src-2.8.12.1/src/generic/treectlg.cpp(201) in GetTextHeight(): must call CalculateSize() first

Is this a bug in wxPython or do I have a new condition to check for before calling EnsureVisible?

The fragment of code leading up to this is:

        if first_item:
            self.tree_ctrl.SelectItem( first_item )
            self.tree_ctrl.EnsureVisible( first_item )

What is the current state of the treectrl at that point? For example, has it been shown and painted at least once? I assume from the above that it has items, how many? Enough to need to be scrolled?

Never shown, one item, does not need scrolling.

If you can duplicate the problem in a small sample I can take a closer look at what is going on.

I'll try to do this.

Barry

···

On 11 Nov 2011, at 22:33, Robin Dunn wrote:

On 11/11/11 12:07 PM, Barry Scott wrote: