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


Groups > comp.lang.python > #25100

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

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.024
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'handler': 0.04; 'prefix': 0.07; 'advice.': 0.09; 'does,': 0.09; 'handlers': 0.09; 'processing,': 0.09; 'gui': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'function;': 0.16; 'naming': 0.16; 'wrote:': 0.17; 'received:209.85.214.174': 0.21; 'header:In- Reply-To:1': 0.25; '(which': 0.26; 'am,': 0.27; 'rules': 0.27; 'convention': 0.27; 'reflect': 0.27; 'message-id:@mail.gmail.com': 0.27; 'actual': 0.28; 'fine': 0.28; 'consistency': 0.29; 'questions.': 0.29; 'toolkit': 0.29; 'case,': 0.29; 'handled': 0.29; 'that.': 0.30; 'button': 0.30; 'johnson': 0.32; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'wrong': 0.34; 'especially': 0.35; 'open': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'should': 0.36; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'nothing': 0.38; 'advice': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'called': 0.39; 'list,': 0.39; 'application': 0.40; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'your': 0.60; "you'll": 0.62; 'jul': 0.65; 'treat': 0.65; 'click': 0.76; 'choices.': 0.84; 'seldom': 0.84; 'subject:gets': 0.84; 'rick': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=0Ya8owTcU9P8a3s4B9Qjl/+hLKQlLrcezf8BUJwKL24=; b=cDzWo+WDDToOXEzY+Y5pNsBcne5vNhvwHYwuOIYKdUYlBahLfAUMWKQmufsYNjdBS+ zX0f2rMwskIPLn+r5uoIudGAM0UtsAX6RhEGsZCuXSx66pt9F+lgcNztv2Z3Ys++uJ5U PL7oRZZ5qEPLoPDGymg0AEHyXxcB62gdx1yonHs0sSuwOfEleRaN2zwMeUGzb1x+oRpq bW2Wt8tnRDGxB5Lw9magNpf8tA3gQus9zEtreq90zF+5ANTFShMR7MZ3rHgzPSecvuRZ rLL0o7CNRiIKoUsd6fivMF7nyFGMc5Cqf0ic/ii/tcTInFfOs31oTzn5SlOVCYSnDpWG f/sg==
MIME-Version 1.0
In-Reply-To <e903a18d-a348-4ba3-8b0c-2b51bca7dbd6@l32g2000yqc.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>
Date Tue, 10 Jul 2012 08:23:39 +1000
Subject Re: Tkinter.event.widget: handler gets name instead of widget.
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.1961.1341872621.4697.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1341872621 news.xs4all.nl 6978 [2001:888:2000:d::a6]:33906
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25100

Show key headers only | View raw


On Tue, Jul 10, 2012 at 3:49 AM, Rick Johnson
<rantingrickjohnson@gmail.com> wrote:
> ALL event handlers should marked as *event
> handlers* using a prefix. I like to use the prefix "evt". Some people
> prefer other prefixes. In any case, just remember to be consistent.
> Also, event handler names should reflect WHAT event they are
> processing, not some esoteric functionality of the application like
> "pick_record" or "info_profile". However if you like, simply have the
> event handler CALL an outside func/meth. This type of consistency is
> what separates the men from the boys.

Or perhaps it separates the half-elves from the hobgoblins.
Hard-and-fast rules are seldom valid in stylistic questions. There's
nothing wrong with having a prefix like "evt" or "on" or whatever;
there's also nothing wrong with a naming convention of PB_Open_Click
(PB for "PushButton" (which is what that GUI toolkit called them),
Open being what the button does, and Click is the event being handled
- that's the VX-REXX convention). Or having no specific event handler
and going straight to your "pick_record" function; that's fine too,
especially if you have multiple entry-points to that.

Frederic, you'll get a lot of advice on this list, but treat it as
just that - advice. There are very few actual rules; read what people
say and then make your own choices.

ChrisA

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