"Bernard Lebel" <[EMAIL PROTECTED]> wrote > Why? Because I'm using an API (the Softimage|XSI scripting API) > where > I have to create a custom GUI (using that API's GUI toolkit). > > I have to attach a logic callback to a number of widgets that can > change from one execution to the next.
Can you show us a simple(!) example, I'm not sure I quite understand the parameters of the problem. How does the XSI GUI execute the code you pass to it? If it executes it by itself then it why not just write the callbacks as strings: ## create a foo wrapper ''' def foo(x): myfoo(x) ''' def myfoo(x): real code here Or do you need to call them too? This might be a valid use for exec: foostr = ''' def foo(x); print x ''' exec(foostr) > The only way to do that, in that API, is to define the callback > functions "on-the-fly". But I'm not sure what the restrictions of 'on the fly' are. How close to runtime must the definition be? Could it be parameterised by a format string? > And to define such a callback, the API > requires that the function must be represented as a string. How bizarre! HTH, Alan G. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor