[Tutor] Adding items to wxListControl

Andy Baker andy at andybak.net
Mon Apr 19 12:02:47 EDT 2004

This is driving me mad!

This is from the examples folder:

        items = musicdata.items()
        for x in range(len(items)):
            key, data = items[x]
            self.list.InsertImageStringItem(x, data[0], self.idx1)
            self.list.SetStringItem(x, 1, data[1])
            self.list.SetStringItem(x, 2, data[2])
            self.list.SetItemData(x, key)

X is a loop counter. What is self.idx1?
What is the last line about! X and the key are the same so what is it doing?

The wxDOcs say:

bool SetItemData(long item, long data)
	Associates application-defined data with this item.

This is about as clear as mud to me! You are passing it two long's. What
does the second long represent?

<whinge> I was getting on really well with Python until I started GUI
programming. For a beginner there seems to be a real lack of clear docs on
both wx and Tk. The general friendliness and quick learning curve of Python
in general don't seem to be there when you move onto GUI programming

More information about the Tutor mailing list