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


Groups > comp.lang.python > #105582

Re: Key Binding Problem

From Wildman <best_lay@yahoo.com>
Subject Re: Key Binding Problem
Newsgroups comp.lang.python
References (1 earlier) <mailman.27.1458702187.2244.python-list@python.org> <L6KdnXoY773thm_LnZ2dnUU7-QOdnZ2d@giganews.com> <mailman.31.1458715678.2244.python-list@python.org> <GZ-dnUtlpauMIG_LnZ2dnUU7-S-dnZ2d@giganews.com> <mailman.74.1458780091.2244.python-list@python.org>
Organization Wildman Productions
Message-ID <06adnbnMouHI027LnZ2dnUU7-XednZ2d@giganews.com> (permalink)
Date 2016-03-23 21:17 -0500

Show all headers | View raw


On Wed, 23 Mar 2016 20:34:08 -0400, Dennis Lee Bieber wrote:

> On Wed, 23 Mar 2016 10:58:09 -0500, Wildman via Python-list
> <python-list@python.org> declaimed the following:
> 
>>On Wed, 23 Mar 2016 02:47:47 -0400, Terry Reedy wrote:
>>
>>>      def load_image(self, _):
>>>          # load image file
>>> 
>>> You must pass the bound method, as you did, and not the function itself 
>>> (which has two parameters).
>>
>>I meant to ask a followup question in my previous post but
>>it slipped my mind.
>>
>>What is the best thing to do...
>>Define all procedures this way, (self. event)?
> 
> 	Not "." but "," -- separate arguments

That was a typo.  My fingers have dyslexia.

> 	Anything that is a method in a class object will tend to receive the
> object itself as the first argument (commonly called "self" in Python, "me"
> in Visual BASIC, "this" in C++). Tk callback functions (I think you were
> using Tkinter) likely pass the event data (that is, what triggered the
> callback -- a key-in callback passes information about the key that was
> pressed).
> 
>>Define all event handlers this way?
> 
> 	If they are methods of a Tk class, then likely they need this format...
> But for classes you create yourself, it depends on how you intend to invoke
> them.

Thanks for the info.

>>Define only the event handlers that will be called from
>>elsewhere in the code, as in this case?
> 
> 	Uhm... If an event handler is never invoked, why write it?

I was referring to procedures called by a button click as
opposed to a procedure calledd from elsewhere in the code.
I guess there is no difference.  I assume that is what you
meant.

-- 
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!

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


Thread

Key Binding Problem Wildman <best_lay@yahoo.com> - 2016-03-22 21:46 -0500
  Re: Key Binding Problem MRAB <python@mrabarnett.plus.com> - 2016-03-23 03:02 +0000
    Re: Key Binding Problem Wildman <best_lay@yahoo.com> - 2016-03-22 23:28 -0500
      Re: Key Binding Problem Terry Reedy <tjreedy@udel.edu> - 2016-03-23 02:47 -0400
        Re: Key Binding Problem Wildman <best_lay@yahoo.com> - 2016-03-23 10:40 -0500
        Re: Key Binding Problem Wildman <best_lay@yahoo.com> - 2016-03-23 10:58 -0500
          Re: Key Binding Problem Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-03-23 20:34 -0400
            Re: Key Binding Problem Wildman <best_lay@yahoo.com> - 2016-03-23 21:17 -0500
              Re: Key Binding Problem Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-03-24 08:06 -0400
                Re: Key Binding Problem Wildman <best_lay@yahoo.com> - 2016-03-24 11:19 -0500
                Re: Key Binding Problem Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-03-24 21:43 -0400
                Re: Key Binding Problem Wildman <best_lay@yahoo.com> - 2016-03-24 23:37 -0500
                Re: Key Binding Problem Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-03-25 12:50 -0400
  Re: Key Binding Problem Terry Reedy <tjreedy@udel.edu> - 2016-03-22 23:52 -0400
    Re: Key Binding Problem Wildman <best_lay@yahoo.com> - 2016-03-22 23:30 -0500

csiph-web