For my r&l series of Python scripts for rendering and lighting, I often wanted to pass extra arguments to functions when clicking a button or changing the value of a field. By importing the partial module from functools you can choose a function and pass extra arguments into it.
You'll need to import the partial module as follows:
Then to define a floatfield that calls a function with arguments, you can use this syntax:
Where the first argument to the partial function is the name of the function you want to call, and the following arguments are the values you want to pass to the function.
The function updateFloat is defined as follows:
Where the listRelatives function returns the transform node of the light defined by the value returned from the contents of the textField. And then you set the attribute of the selected light based on the 'kind' argument passed in, and update it to the value defined in the list of args that was passed by the UI element.