How to close specific area types down using python. Definitely don't want to switch area types, or be jumping in out fullscreen mode?

Close Vertically? or Close Horizontally? Since Blender developers already use the principle, top to bottom, left to right. Then why don't we just start from the top?

enter image description here

Here is a basic example of it working. The above illustration is what should be really focused on though. closing down a middle window.

enter image description here

Any guidance on this would be amazing. Thank you


1 Answer 1


i think you need to override context to not close the area in which you are working: here is an example that you can run from Text editor:

import bpy

override_context = bpy.context.copy() 
area = [area for area in bpy.context.screen.areas if area.type == "NODE_EDITOR"][-1]     
override_context['window'] = bpy.context.window
override_context['screen'] = bpy.context.screen
override_context['area'] = area
override_context['region'] = area.regions[-1]
override_context['scene'] = bpy.context.scene

areas = [area for area in bpy.context.screen.areas if area.type == "NODE_EDITOR"]

for area in areas:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .