How to split and join Blender interface windows thruough the python API

A set of operators is provided in Blender for manipulating with the location of its interface windows.

To split the current window (using the current context) into two in a specified ratio, we need to execute the following operator:

With:

  • direction – set the splitting direction (‘HORIZONTAL’ or ‘VERTICAL’)
  • factor – percentage ratio of splitting windows

A new window (new area) is appended to the end of the bpy.context.screen.areas list and can be obtained through the:

To join two windows into one, we need to execute the following operator:

With:

  • x1, y1 – left top corner coordinates of the joined window (area)

Area corner coordinates we can get from the area “x” and “y” properties:

0 0 votes
Article Rating
Subscribe
Notify of
guest

16 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Peeter Maimik
Peeter Maimik
2 years ago

Does the joining of the areas here work for the active area (the one where the cursor is currently, or which has been clicked most recently)? Or does it just work for the area that was created last?

Peeter Maimik
Peeter Maimik
2 years ago
Reply to  Peeter Maimik

I’d like to be able to join the area where the cursor is hovering with another one…

Peeter Maimik
Peeter Maimik
2 years ago
Reply to  Nikita

Do you have any tips on how to find coordinates of the active area? I believe the bpy.context.screen.areas[1] refers to the area that was created last, but not necessarily the active area. Thanks.

Peeter Maimik
Peeter Maimik
2 years ago
Reply to  Peeter Maimik

Also, could you confirm whether you made a typo in your article? It says x1, y1 are left top corner coordinates. But if I understand correctly, x1 is top left and y1 is actually bottom right?

Peeter Maimik
Peeter Maimik
2 years ago
Reply to  Peeter Maimik

Actually, I have tried seemingly every possible option but in my case screen area join just doesn’t do anything. I also attempted the script that was shared in this forum: https://devtalk.blender.org/t/join-two-areas-by-python-area-join-what-arguments-blender-2-80/18165/7

zhouxinlin
zhouxinlin
2 years ago
Reply to  Peeter Maimik

should be:bpy.ops.screen.area_join(cursor=(new_area.x+new_area.width+2, new_area.y+2))

zhouxinlin
zhouxinlin
2 years ago
Reply to  zhouxinlin

And blender will definitely not redraw, you need to find another redraw function.

Neuroup
Neuroup
3 years ago

Hello Nikita 🙂

Could you give an example of another way to connect two windows. For example, by the type of window. For example, VIEW_3D merges with INFO. It’s hard to find which window has what number is assigned.

Neuroup
Neuroup
3 years ago
Reply to  Nikita

Ok, Thank You for Your reply. This method is ok, but sometimes different user, have different resolution of screen . And You must know how big is area…
Tries to create a scrypt that automatically join area to recognize type.
Greets and thanks for help 🙂