Ugly little issue with Tkinter - Pmw.Counter - datatype
Matthew Dixon Cowles
matt at mondoinfo.com
Fri Mar 29 20:34:53 EST 2002
On Fri, 29 Mar 2002 16:17:39 -0600, Paul Sage <psage at ncaustin.com> wrote:
>The function header currently looks like this:
>
>def custom_counter_body(self, text, factor, increment):
>
>I need it to look like this:
>
>Def custom_counter_body(self, text, factor, increment, thePlayer)
Dear Paul,
I suspect that you could use an object with a __call__method. You
could store the state when creating the object and have the __call__
method take the arguments that Pmw supplies. Something like this might
work:
class callbackObject:
def __init__(self,thePlayer):
self.thePlayer=thePlayer
def __call__(self, text, factor, increment):
# Do something involving those arguments
# and self.thePlayer
return 42
Regards,
Matt
More information about the Python-list
mailing list