Button press event - event handling and picking: IndexError: list index out of range

Cousin Stanley cousinstanley at gmail.com
Tue Jun 9 11:00:43 EDT 2020


Caledonian26 wrote:

....
> However, I keep getting the error: 
> 
>   IndexError: list index out of range. 
> 
>  Could anyone give me a helping hand 
>  as to where I am going wrong?
> 

  I appended a single arbitrary value for limits  
  since the  limits  list had not been previously
  initialized .... 
  
  ....

  colourofbars = [ ]

  for key , value in dict_means.items() :

      limits.append( 3000 )

      if limits[ 0 ] > ( key + ( value ) ) :
  ....

  This fix gets past the  index out of range  error
  and produces a plot which might let you proceed
  to the next problem you might encounter ....


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona



More information about the Python-list mailing list