yeah, that looks exactly like the error that you get when a callback does not support python. autodesk has been trying to find and fix these broken callbacks since 8.5, but it looks like they may have overlooked it when implementing this new one.
since autodesk does not have an open bug tracker, the pymel group hosts a google doc with python-related bugs: http://spreadsheets.google.com/ccc?key=pdI8BlSwGdr0btApDuZEcKQ&inv=py ... feel free to post.... -chad On May 25, 2009, at 4:11 PM, mtherrell wrote: > > can anyone shed some light on this? > i am trying to use the new 'treeView' gui in python. > > this gui comes with allot of great callback triggers and would have > allot of great functionality for what i am trying to use it for. > however, i am currently stumped: > > i cannot assign python functions as callbacks. > i have tried every conventional way of doing this, ways that work find > on other interface callbacks, > > (string formating for positional arguments, lambda, functions that > accept variable numbers of args.. > below are examples of each). but i always get an error with a memory > address included. like: > > // Error: <function at 0x000000001E39A208> "layer 1" "newname"; // > // Error: Line 1.1: Syntax error // > > is it possible that even though they say this gui is availabe for > python, that it really is not??!, because this looks like it may be > expecting only a mel proc as a callback.... because of the syntax > error thing. > > here are four python examples of ways of doing this that work fine on > other gui: > (i am creating the callbacks on the 'editLabelCommand' signal. > so try to double click on the treeViewItem and rename it after > creating each example to see my problem) > > > ###### example1: positional arg failure treeView example > def foo(a, b): > print a, b > return a > > from maya import cmds > window = cmds.window() > layout = cmds.formLayout() > > control = cmds.treeView( parent = layout, numberOfButtons = 3, abr = > False, elc = foo) > > cmds.formLayout(layout,e=True, attachForm=(control,'top', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'left', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'bottom', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'right', 2)) > > cmds.showWindow( window ) > > cmds.treeView( control, e=True, addItem = ("layer 1", "")) > > > ###### example2 wild-card args function positional arg failure > treeView example > def poo(*args): > print "callback args: " + str(args[1:]) > return args[1] > > from maya import cmds > window = cmds.window() > layout = cmds.formLayout() > > control = cmds.treeView( parent = layout, numberOfButtons = 3, abr = > False, elc = poo) > > cmds.formLayout(layout,e=True, attachForm=(control,'top', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'left', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'bottom', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'right', 2)) > > cmds.showWindow( window ) > > cmds.treeView( control, e=True, addItem = ("layer 1", "")) > > > ###### example3: "catch-all arg" lamba positional arg failure treeView > example > def goo(arg1,arg2): > print "callback args: " +arg1) > return arg1 > > from maya import cmds > window = cmds.window() > layout = cmds.formLayout() > elc_cmd = lambda *args: goo(arg1,arg2) > control = cmds.treeView( parent = layout, numberOfButtons = 3, abr = > False, elc = elc_cmd) > > cmds.formLayout(layout,e=True, attachForm=(control,'top', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'left', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'bottom', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'right', 2)) > > cmds.showWindow( window ) > > cmds.treeView( control, e=True, addItem = ("layer 1", "")) > > ###### example4: string positional arg failure treeView example > def goo(arg1,arg2): > print "callback args: " + str(args[1:]) > return arg1 > > from maya import cmds > window = cmds.window() > layout = cmds.formLayout() > elc_cmd = "goo(\'%(1)s\',\'%(2)s\')" > control = cmds.treeView( parent = layout, numberOfButtons = 3, abr = > False, elc = elc_cmd) > > cmds.formLayout(layout,e=True, attachForm=(control,'top', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'left', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'bottom', 2)) > cmds.formLayout(layout,e=True, attachForm=(control,'right', 2)) > > cmds.showWindow( window ) > > cmds.treeView( control, e=True, addItem = ("layer 1", "")) > > ## thanks for any help! > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
