Adding method to a class on the fly

John Henry john106henry at hotmail.com
Sun Jun 24 21:40:00 CEST 2007


On Jun 24, 1:19 am, John Henry <john106he... at hotmail.com> wrote:
> On Jun 23, 6:24 pm, Steven D'Aprano
>
> <s... at REMOVE.THIS.cybersource.com.au> wrote:
> > On Sat, 23 Jun 2007 12:31:39 -0700, John Henry wrote:
> > > it works fine but PythonCard isn't calling this function when I
> > > clicked on the button.
>
> > I think you need to take this question onto a PythonCard list. I have no
> > idea how PythonCard decides which method to call.
>
> > --
> > Steven.
>
> I did.  I am not sure I'll get an answer though.
>
> Thanks for the help.

Upon further investigation, I found the problem.

Pythoncard is relying on the __name__ attribute and that's why it
didn't know about the newly careated function.  I can not set that
attribute directly, of course, since it's a readonly attribute.  Need
other workaround.

The author of Pythoncard has responded and so I am shifting this
thread over to the Pythoncard list.

Thanks again for all the help.  I learned a few things about Python
through this exercise.




More information about the Python-list mailing list