Post #1510: ![](https://blenderartists.org/user_avatar/blenderartists.org/bitinn/48/494209_2

📋 Metadata

🏷️ Tags

pie-menu hotkeys intermediate solved

  • Command tab
  • Property tab
  • Custom tab
  • Custom Icons
  • Python Scripting

💬 Content

bitinn:

Just wondering, is it possible to call wm.context_toggle in a menu item with Pie Menu Editor. I want to emulate what I can do with Blender Input key-binding. But it seems like the closest option I got is to use “Property”, which will toggle the true/false value just like wm.context_toggle, but using Property doesn’t allow me to customize menu icon for some reasons?

You can call it in Command tab, eg:

bpy.ops.wm.context_toggle(data_path='tool_settings.use_proportional_edit_objects')

Or use in Property tab:

C.tool_settings.use_proportional_edit_objects

If you want to use custom icon you need to use Custom tab:

operator(L, "wm.context_toggle", icon='CHECKBOX_HLT' if  C.tool_settings.use_proportional_edit_objects else 'CHECKBOX_DEHLT', data_path='tool_settings.use_proportional_edit_objects')

🔗 View on Blender Artists