Newbie wxPython ListCtrl Question

limodou limodou at gmail.com
Wed Nov 16 20:06:39 EST 2005


2005/11/17, Todd7 <nospam at please.net>:
> I am new to python and to wxWindows.  I have tried searching google,
> reading the documentation and trying to figure out some of the examples,
> but I am stumped as to how to get information out of a listctrl at a
> certain row and column.  I tried to write a simple example to learn to
> work with the listctrl as follows:

I'v made some helper function as that:

    def getRowText(self, index, col):
        if index >= 0:
            return self.list_ctrl_1.GetItem(index, col).GetText()
        else:
            return ''

    def getSelRowText(self, col):
        return self.getRowText(self.getSelection(), col)

    def getSelection(self):
        return self.list_ctrl_1.GetNextItem(-1, wx.LIST_NEXT_ALL,
wx.LIST_STATE_SELECTED)

You can just use self.getSelRowText(1) to gain the second column text
of selection row.
--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit



More information about the Python-list mailing list