Phoenix: DataViewTreeCtrl crashes when using ItemData

Torsten <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 
bit (Intel)] on win32
wxPython 3.0.3.dev1830+0b5f910 msw (phoenix)


When using DataViewTreeCtrl where an item has data associated with it, the 
app crashes on exit or when trying to get the item data.
I've added a small test app. When uncommenting the line with SetItemData(), 
the app won't crash.

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
DVTreeCtrl-GetItemData.py (text/x-python, 838 B)
import wx
import wx.dataview as DVC

class MainFrame(wx.Frame):
    def __init__(self):
        super(MainFrame, self).__init__(None)

        btn = wx.Button(self, wx.ID_ANY, label='Get Item Data')
        btn.Bind(wx.EVT_BUTTON, self.OnGetData)

        self.treeCtrl = DVC.DataViewTreeCtrl(self, wx.ID_ANY, style=DVC.DV_ROW_LINES | DVC.DV_NO_HEADER)
        self.tree_root = self.treeCtrl.AppendContainer(DVC.NullDataViewItem, "Root")
        self.treeCtrl.SetItemData(self.tree_root, 'Data')

        szr = wx.BoxSizer(wx.VERTICAL)
        szr.Add(btn)
        szr.Add(self.treeCtrl, 1, wx.EXPAND)
        self.SetSizer(szr)

    def OnGetData(self, event):
        myData = self.treeCtrl.GetItemData(self.tree_root)

if __name__ == '__main__':
    app = wx.App(redirect=False)
    win = MainFrame()
    win.Show()
    app.MainLoop()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.