[Tutor] pass a function name as an argument

Peter He qhe@ydyn.com
Mon, 23 Jul 2001 14:03:51 -0500


Hi there,

How can I pass a function name as an argument to another function?

Something like this:

class a:
     ...
# call func_A to create a button with title -- text and function -- func_B
     func_A(text, func_B)
     ...


func_A(self, text, func)
     ...
     buttonbox = Pmw.buttonbox(...)
     buttonbox.pack(...)

     buttonbox.add(text, func)
     ...

func_B(self)
     ...
     do something here.
     ...

In this way, I want to create command button dynamically. But how can I 
pass func_B as an argument here?

Thank you!

Peter