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


Groups > comp.lang.python > #25170

Re: Tkinter.event.widget: handler gets name instead of widget.

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <anthra.norell@bluewin.ch>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'explicitly': 0.04; 'assign': 0.07; 'indexing': 0.07; 'tkinter': 0.07; 'x-mailer:evolution 2.28.3': 0.07; 'effect.': 0.09; 'indexes': 0.09; 'itself.': 0.11; 'passing': 0.15; '*always*': 0.16; 'above)': 0.16; 'also:': 0.16; 'assigns': 0.16; 'is;': 0.16; 'iterables': 0.16; 'received:195.186': 0.16; 'received:bluewin.ch': 0.16; 'wrote:': 0.17; 'skip:" 40': 0.20; 'names.': 0.22; 'header:In-Reply-To:1': 0.25; 'setting': 0.26; '[1]': 0.27; '[2]': 0.27; 'label': 0.27; '-0700,': 0.29; 'obj': 0.29; 'yes.': 0.29; 'function': 0.30; '(and': 0.32; 'url:python': 0.32; 'johnson': 0.32; 'says': 0.33; 'to:addr:python-list': 0.33; 'changed': 0.34; 'thanks': 0.34; 'list': 0.35; 'built-in': 0.35; 'something': 0.35; 'there': 0.35; 'url:org': 0.36; 'development.': 0.36; 'url:library': 0.36; "didn't": 0.36; 'why': 0.37; 'drop': 0.37; 'subject:: ': 0.38; 'skip:( 30': 0.38; 'easier': 0.38; 'url:docs': 0.38; 'instead': 0.39; 'performance': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'skip:" 10': 0.40; 'received:192.168': 0.40; 'your': 0.60; 'needing': 0.62; 'url:0': 0.67; 'received:ch': 0.69; 'url:htm': 0.71; 'blow': 0.84; 'is)': 0.84; 'subject:gets': 0.84; 'url:functions': 0.84; 'habit': 0.91; 'rick': 0.91
Subject Re: Tkinter.event.widget: handler gets name instead of widget.
From Frederic Rentsch <anthra.norell@bluewin.ch>
To python-list@python.org
In-Reply-To <25935b3c-b37d-465f-9855-7ecf2c3bdf4e@h10g2000yqn.googlegroups.com>
References <1341782353.2041.136.camel@hatchbox-one> <mailman.1933.1341813557.4697.python-list@python.org> <e903a18d-a348-4ba3-8b0c-2b51bca7dbd6@l32g2000yqc.googlegroups.com> <mailman.1984.1341914689.4697.python-list@python.org> <89816e26-fc20-4cdc-ba6c-f252231d43ba@f16g2000yqg.googlegroups.com> <25935b3c-b37d-465f-9855-7ecf2c3bdf4e@h10g2000yqn.googlegroups.com>
Content-Type text/plain; charset="UTF-8"
Date Wed, 11 Jul 2012 09:59:27 +0200
Mime-Version 1.0
X-Mailer Evolution 2.28.3
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2010.1341993643.4697.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1341993644 news.xs4all.nl 6896 [2001:888:2000:d::a6]:49411
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25170

Show key headers only | View raw


On Tue, 2012-07-10 at 18:06 -0700, Rick Johnson wrote:
> Also:
> 
> Q3: Why are you explicitly setting the name of your "subFrame" widgets
> instead of allowing Tkinter to assign a unique name?...AND are you
> aware of the conflicts that can arise from such changes[1]?
> 

I find custom-named widgets easier to work with during development. I can tell
what this is; ".main-frame.data-frame.title-hit-list.-10-". If I didn't assign
names it would look something line this:".2837029.283725.283762.2848308".  
Once my program works I can drop custom-naming.
   I understand that conflicts may arise if one assigns numeric names.
To find out whether the digits in the label names ('-10-' above) might
be implicated, I changed to spelled-out names ('ten'). The change had no
effect. The reference you list blow (x147-more-on-widget-names.htm)
indeed says "don't use names which only contain digits". 

> Q4: Are you aware of the built-in function "enumerate"[2]? I see you
> are passing around indexes to iterables AND simultaneously needing the
> obj reference itself. I prefer to keep indexing to a minimum.  If
> there is no bleeding edge performance issue to worry about (and there
> almost *always* never is) why not use enumerate?
> 
Aware, yes. In the habit of, no. Thanks for the reminder.

> [1] http://www.pythonware.com/library/tkinter/introduction/x147-more-on-widget-names.htm
> [2] http://docs.python.org/release/3.0.1/library/functions.html#enumerate

Frederic

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


Thread

Re: Tkinter.event.widget: handler gets name instead of widget. Terry Reedy <tjreedy@udel.edu> - 2012-07-09 01:58 -0400
  Re: Tkinter.event.widget: handler gets name instead of widget. Rick Johnson <rantingrickjohnson@gmail.com> - 2012-07-09 10:49 -0700
    Re: Tkinter.event.widget: handler gets name instead of widget. Terry Reedy <tjreedy@udel.edu> - 2012-07-09 15:45 -0400
    Re: Tkinter.event.widget: handler gets name instead of widget. Frederic Rentsch <anthra.norell@bluewin.ch> - 2012-07-09 22:47 +0200
    Re: Tkinter.event.widget: handler gets name instead of widget. Chris Angelico <rosuav@gmail.com> - 2012-07-10 08:23 +1000
    Re: Tkinter.event.widget: handler gets name instead of widget. Frederic Rentsch <anthra.norell@bluewin.ch> - 2012-07-10 12:03 +0200
      Re: Tkinter.event.widget: handler gets name instead of widget. Rick Johnson <rantingrickjohnson@gmail.com> - 2012-07-10 15:11 -0700
        Re: Tkinter.event.widget: handler gets name instead of widget. Rick Johnson <rantingrickjohnson@gmail.com> - 2012-07-10 18:06 -0700
          Re: Tkinter.event.widget: handler gets name instead of widget. Frederic Rentsch <anthra.norell@bluewin.ch> - 2012-07-11 09:59 +0200
        Re: Tkinter.event.widget: handler gets name instead of widget. Frederic Rentsch <anthra.norell@bluewin.ch> - 2012-07-12 20:53 +0200
          Re: Tkinter.event.widget: handler gets name instead of widget. rantingrickjohnson@gmail.com - 2012-07-14 20:10 -0700
            Re: Tkinter.event.widget: handler gets name instead of widget. Frederic Rentsch <anthra.norell@bluewin.ch> - 2012-07-16 12:32 +0200
          Re: Tkinter.event.widget: handler gets name instead of widget. rantingrickjohnson@gmail.com - 2012-07-14 20:10 -0700
        Re: Tkinter.event.widget: handler gets name instead of widget. Peter Otten <__peter__@web.de> - 2012-07-13 09:26 +0200
        Re: Tkinter.event.widget: handler gets name instead of widget. Frederic Rentsch <anthra.norell@bluewin.ch> - 2012-07-13 22:24 +0200
        Re: Tkinter.event.widget: handler gets name instead of widget. Terry Reedy <tjreedy@udel.edu> - 2012-07-13 19:23 -0400
        Re: Tkinter.event.widget: handler gets name instead of widget. Peter Otten <__peter__@web.de> - 2012-07-14 09:47 +0200

csiph-web