Hello all.
I`m trying to load a wxlistcrtrl with the contents of a file and i`m getting
crazy.
i`m using python 22 and wxpython 2.4.0.7
A line of that file is like:
>03802|3064|000000|2|01|magenta|000000|0|0000004677|identif_01
and i´m using:
i=0
while 1:
a=fi.readline()[:-1]
if not a: break
for b in range (len(string.split(a, '|'))):
self.listCtrl1.SetStringItem(i, b, string.split(a, '|')[b])
self.listCtrl1.SetItemData(i, b)
i=i+1
can anyone help me??
Thanks
Enrique
**AVISO DE CONFIDENCIALIDAD**
La información contenida en este mensaje y archivos es privada y confidencial estando dirigida solamente al destinatario. Si Ud. ha recibido esta información por error, por favor, proceda a su inmediata destrucción. Cualquier opinión o punto de vista contenido en este mensaje corresponde al remitente y necesariamente no representa la opinión del GRUPO XEROX.
A line of that file is like:
>03802|3064|000000|2|01|magenta|000000|0|0000004677|identif_01
and i�m using:
i=0
while 1:
a=fi.readline()[:-1]
if not a: break
for b in range (len(string.split(a, '|'))):
self.listCtrl1.SetStringItem(i, b, string.split(a,
'|')[b])
self.listCtrl1.SetItemData(i, b)
i=i+1
Inserting the first column requires a different method than the rest of
the row:
alist = string.split(a, '|')
for b in range(len(alist)):
if b == 0: # first column
self.listCtrl1.InsertStringItem(i, alist[0])
else: # remaining columns
self.listCtrl1.SetStringItem(i, b , alist[b])
self.listCtrl1.SetItemData(i, b)
Regards,
David Hughes
Forestfield Software Ltd
www.forestfield.co.uk
Would it be nice if the SetStringItem() method was clever
enough to use InsertStringItem() if the second arg is zero?
/Jean Brouwers
David Hughes wrote:
···
A line of that file is like:
>03802|3064|000000|2|01|magenta|000000|0|0000004677|identif_01
and i´m using:
i=0
while 1:
a=fi.readline()[:-1]
if not a: break
for b in range (len(string.split(a, '|'))):
self.listCtrl1.SetStringItem(i, b, string.split(a, '|')[b])
self.listCtrl1.SetItemData(i, b)
i=i+1
Inserting the first column requires a different method than the rest of the row:
alist = string.split(a, '|')
for b in range(len(alist)):
if b == 0: # first column
self.listCtrl1.InsertStringItem(i, alist[0])
else: # remaining columns
self.listCtrl1.SetStringItem(i, b , alist[b])
self.listCtrl1.SetItemData(i, b)
Regards,
David Hughes
Forestfield Software Ltd
www.forestfield.co.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org