Code without effect (wx demo TreeCtrl.py ImageList)

Martin Drautzburg martin.drautzburg at web.de
Mon Dec 20 02:30:26 EST 2004


In the wx demoy TreeCtrl.py I find the following code, that should
have no effect but seems to be needed nevertheless.

class TestTreeCtrlPanel(wx.Panel):
    def __init__(self, parent, log):
        [...}
        self.tree = MyTreeCtrl(self, tID, wx.DefaultPosition, ...
        isz = (16,16)
        il = wx.ImageList(isz[0], isz[1])
        fldridx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART...
        [...]

        self.tree.SetImageList(il)
-->     self.il = il
    
What is the effect of the last statement? self.il is not used
anywhere. I used similar code in my application and it crashes unless
I assign the image list to the parent panel. The name of the attribute
does not seem to matter. I can write self.foo=il just as well, but
without it it crashes.



More information about the Python-list mailing list