Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #63216

Re: gotta love radio buttons

Date 2014-01-05 11:51 -0800
From Gary Herron <gary.herron@islandtraining.com>
Subject Re: gotta love radio buttons
References <8dca57e8-8258-4020-9788-987af332b5b2@googlegroups.com> <1dffaef8-ba59-4bbf-b8ac-02c611640f92@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.4962.1388951520.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 01/05/2014 10:47 AM, eneskristo@gmail.com wrote:
> Now it is giving me this error, after changing to helper = var[r.get()]
> line 27, in submit_data
>      self.something_else[r][1] += 1
> TypeError: list indices must be integers, not IntVar

In such an easy case, you really ought to be able to read the error and 
understand it rather than needing to rely on us to do that for you.

The message:
     List indices must be integers, not IntVar
clearly indicates you are indexing a list with something of type IntVar 
instead of the required int.    That would have to be the ...[r].  The 
value of r is *not* an integer, it's an IntVar which is container of an 
int but not an int itself.  You can access the contained int with 
r.get(), so perhaps ...[r.get()] is what you want.  (Or perhaps not...  
We really don't know what you are trying to do here.)


Reading error messages and understanding tracebacks are skills well 
worth trying to develop.  Good luck.

Gary Herron

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

gotta love radio buttons eneskristo@gmail.com - 2014-01-05 10:18 -0800
  Re: gotta love radio buttons Roy Smith <roy@panix.com> - 2014-01-05 13:33 -0500
  Re: gotta love radio buttons Ned Batchelder <ned@nedbatchelder.com> - 2014-01-05 13:37 -0500
  Re: gotta love radio buttons Kev Dwyer <kevin.p.dwyer@gmail.com> - 2014-01-05 18:40 +0000
  Re: gotta love radio buttons eneskristo@gmail.com - 2014-01-05 10:47 -0800
    Re: gotta love radio buttons Gary Herron <gary.herron@islandtraining.com> - 2014-01-05 11:51 -0800
  Re: gotta love radio buttons Gary Herron <gary.herron@islandtraining.com> - 2014-01-05 10:38 -0800

csiph-web