I have a little problem with derived classes, namely wx.ListItemwith wx.ListCtrl. I successfully got wx.ListItemhow MediaItem, the code is not finished, but you get the point:
class MediaItem(wx.ListItem):
def __init__ (self, fullname):
wx.ListItem.__init__(self)
self.fullname = fullname
self.filename = os.path.basename(fullname)
def getFullname(self):
return self.fullname
wx.ListCtrlgladly accepts this because of the Pythons duck philosophy. But now the problem is that using the method wx.ListCtrl.GetItem(index)returns a ListItem, not MediaItem. Python complained about wx.ListItemhaving no attribute getFullname.
Casting objects seems to be the wrong approach to solving. This probably has nothing to do with the problem, but I also insert the violation line:
filename = self.filelist.GetItem(event.GetIndex()).getFullname()
Where self.filelistthere is wx.ListCtrl.
progo