X
Xavier Barthelemy
Hi all
I'm becoming mad, because I can't see what's wrong:
I am constructing a GUI, to plot some data.
so let's have a look of what's wrong:
in my code I have a variable named choice.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.current)
I have: int and tuple
print type(i),type(choice.current[0])
I have: int and str
print type(i),type(int(choice.current[0]))
I have: int and int
so when I call another array with these indices
ArrayWithData[i,int(choice.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.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]),...]
I'm becoming mad, because I can't see what's wrong:
I am constructing a GUI, to plot some data.
so let's have a look of what's wrong:
in my code I have a variable named choice.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.current)
I have: int and tuple
print type(i),type(choice.current[0])
I have: int and str
print type(i),type(int(choice.current[0]))
I have: int and int
so when I call another array with these indices
ArrayWithData[i,int(choice.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.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]),...]