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: 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: References: <1341782353.2041.136.camel@hatchbox-one> Date: Tue, 10 Jul 2012 08:23:39 +1000 Subject: Re: Tkinter.event.widget: handler gets name instead of widget. From: Chris Angelico 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Tue, Jul 10, 2012 at 3:49 AM, Rick Johnson 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