I want to call FileSelector inside a class with a member of this class as a callback and I get bad results, first try:
class ScnExporter: def my_function(self, filename): print 'The selected file was:', filename def chooseFile(self): Window.FileSelector(self.my_function, 'SAVE FILE') scnExporter = ScnExporter() scnExporter.chooseFile()
I get a:
expected a callback function (and optionally one or two strings) as argument(s)
And now the same thing with a lambda function:
def chooseFile(self): Window.FileSelector(lambda filename, self=self: self.my_function(filename), 'SAVE FILE')
No errors, when I execute the script I see the dialog box but Blender segfault when I press “Save” (It’s really the complete code).
Do you know how to make it works(at least case 1)?