In a Pie menu instead of switching just edit/object mode I would also like to swap out the content of the display like from 3D view switch to node editor for the selected object. But I have a hard time figuring out how to write this.
I went to the API page to see if many I can get some clues from there. https://www.blender.org/api/blender_python_api_2_76_2/bpy.context.html?highlight=context.area#bpy.context.area
If I switch the modes the console reads this out:
bpy.context.area.type = 'IMAGE_EDITOR' bpy.context.area.type = 'NODE_EDITOR' bpy.context.area.type = 'VIEW_3D'
To define a edit/object mode switch I 3D view I know you can do it this way:
bpy.ops.object.editmode_toggle() pie.operator("object.editmode_toggle", text="Edit/Object", icon='OBJECT_DATAMODE')
So I tried this but obviously it odes not work
With the following error message:
Traceback (most recent call last): File "\Modeling Toolbox Pie Beta.py", line 654, in draw AttributeError: 'NoneType' object has no attribute 'type' location: <unknown location>:-1