How to do toggle wireframe in python?

enter image description here

import bpy

for area in bpy.context.workspace.screens[0].areas:
    for space in area.spaces:
        if space.type == 'VIEW_3D':
            space.overlay.show_wireframes = True

How to make switching two state on and off?

  • $\begingroup$ blender.stackexchange.com/questions/124347/… $\endgroup$
    – batFINGER
    Jan 29 '19 at 11:01
  • $\begingroup$ With regards to the overlay setting note batFINGER's link but space.overlay.show_wireframes = True instead of space.shading.type = my_shading $\endgroup$
    – Ratt
    Jan 29 '19 at 13:53
  • $\begingroup$ @Ratt Thanks! Working fine, but how to make switching two state on and off? $\endgroup$
    – Alex
    Jan 30 '19 at 4:54

Not operator:

space.overlay.show_wireframes = not space.overlay.show_wireframes 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.