[wxPython-users] TreeListCtr.SelectAll on Mac OSX throws exception
Robin Dunn
robin at alldunn.com
Tue Jul 4 19:25:26 PDT 2006
Frank Niessink wrote:
> Hi, the following throws an exception (assertion error actually) on
> python 2.4.1/wxPython 2.6.3.2rc2 (universal) on Mac OSX Intel:
>
> import wx
> import wx.gizmos as gizmos
>
> app = wx.App(0)
> frame = wx.Frame(None)
> t = gizmos.TreeListCtrl(frame)
> t.AddColumn('Column 1')
> root = t.AddRoot('Root')
> t.SelectAll()
> frame.Show()
> app.MainLoop()
>
> Running it produces the following output:
>
> Traceback (most recent call last):
> File "selectall.py", line 9, in ?
> t.SelectAll()
> File
> "//Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/wx-2.6-mac-unicode/wx/gizmos.py",
> line 878, in SelectAll
> return _gizmos.TreeListCtrl_SelectAll(*args, **kwargs)
> wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed in
> contrib/gizmos/wxCode/src/treelistctrl.cpp(2931): invalid tree style
SelectAll is only supposed to work on trees with the wx.TR_MULTIPLE
style, and that is what that assertion is trying (not very well) to tell
you. However it looks like there is another problem with it as adding
that style results in a core dump. I'll take a look at that.
...later...
The crash is happening because there is no item except the root, so
until I get a fix distributed you can simply check for that condition
and don't call SelectAll in that case.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list