[SciPy-user] problem in reading a indices

Xavier Barthelemy xavier.barthelemy@cmla.ens-cachan...
Thu Dec 13 04:48:43 CST 2007


Hi all

I'm becoming mad, because I can't see what's wrong:

I am constructing a GUI, to plot some datas.
so let's have a look of what's wrong:



in my code I have a variable named choice[i].current which is the 
current selection of the i-th Listbox object. it is a tuple, with one 
element.

so when I write

print type(i),type(choice[i].current)
I have: int and tuple

print type(i),type(choice[i].current[0])
I have: int and str

print type(i),type(int(choice[i].current[0]))
I have: int and int

so when I call another array with these indices
ArrayWithData[i,int(choice[i].current[0])]

I have the following error: TypeError: list indices must be integers

so I tried an intermediate value, because sometimes, the oneliner code 
doesn't work, so with an intermediate passage: 
value=int(choice[i].current[0])
ArrayWithData[i,value]

I have the same error

and I don't understand why. What's wrong?
May anyone have an idea?
Xavier

pm:
and print type(ArrayWithData), ArrayWithData gives me
<type 'list'> [array([ 2.01,  5.01]),...]




More information about the SciPy-user mailing list