Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63210
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <gary.herron@islandtraining.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'assign': 0.07; 'element': 0.07; 'error:': 0.07; 'indices': 0.07; 'received:67.192': 0.09; 'received:67.192.241': 0.09; 'received:dfw.emailsrvr.com': 0.09; 'python': 0.11; 'integers,': 0.16; 'redundancy': 0.16; 'redundant.': 0.16; 'skip:3 30': 0.16; 'subject:buttons': 0.16; 'typeerror:': 0.16; 'elements': 0.16; 'wrote:': 0.18; '(but': 0.19; 'advance.': 0.19; 'later': 0.20; 'header:User-Agent:1': 0.23; 'helper': 0.24; 'received:emailsrvr.com': 0.24; 'received:(smtp server)': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "i'm": 0.30; 'lines': 0.31; 'gary': 0.31; 'info.': 0.31; 'file': 0.32; '(most': 0.33; 'but': 0.35; 'var': 0.36; 'so,': 0.37; 'two': 0.37; 'list': 0.37; 'being': 0.38; 'button': 0.38; 'expected': 0.38; 'thank': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'remove': 0.60; 'radio': 0.60; 'then,': 0.60; 'first': 0.61; 'email addr:gmail.com': 0.63; 'more': 0.64; '26,': 0.68 |
| X-Virus-Scanned | OK |
| Date | Sun, 05 Jan 2014 10:38:08 -0800 |
| From | Gary Herron <gary.herron@islandtraining.com> |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: gotta love radio buttons |
| References | <8dca57e8-8258-4020-9788-987af332b5b2@googlegroups.com> |
| In-Reply-To | <8dca57e8-8258-4020-9788-987af332b5b2@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4957.1388947598.18130.python-list@python.org> (permalink) |
| Lines | 44 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1388947598 news.xs4all.nl 2978 [2001:888:2000:d::a6]:45339 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:63210 |
Show key headers only | View raw
On 01/05/2014 10:18 AM, eneskristo@gmail.com wrote:
> So, I'm having this radio button issue in tkinter:
> First I assign the IntVar:
> var = []
> while i < self.something:
> var.append(IntVar())
> i += 2
> Later on I use them, but I get this error:
> for r in var:
> helper = var[r].get()
> self.something_else[helper] += 1
> Then, this happens:
> Traceback (most recent call last):
> File "F:\Portable Python 3.2.5.1\App\lib\tkinter\__init__.py", line 1456, in __call__
> return self.func(*args)
> File "----(Not giving this)", line 26, in submit_data
> helper = var[r].get()
> TypeError: list indices must be integers, not IntVar
> I'm willing to give additional info. Thank you in advance.
These two lines
for r in var:
helper = var[r].get()
are being redundant.
The loop returns elements from the list (one-by-one). Also var[r]
attempts to return an element from the list (indexed by r -- expected to
be an integer).
Either of these remove the redundancy (but the first is more Pythonic)
for r in var:
helper = r.get()
or
for i in range(len(var)):
helper = var[i].get()
Gary Herron
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll 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