6
$\begingroup$

Found nothing in Python API to set Screen type (other than "Default").

Is it possible?

My need is to set it programmatically, with python script !

$\endgroup$

2 Answers 2

6
$\begingroup$

bpy.context.screen is a shorthand, but read-only.

You can set a screen via the Window object, which actually holds the screen reference:

bpy.context.window.screen = bpy.data.screens['UV Editing']

http://www.blender.org/documentation/blender_python_api_2_70_release/bpy.types.Window.html#bpy.types.Window.screen

There's also an operator to change screen by a number, relative to the currently active screen:

bpy.ops.screen.screen_set(delta=1) # select screen after current from list

This is what CtrlLeft and CtrlRight trigger (with a delta of -1 or 1 respectively).

$\endgroup$
3
$\begingroup$

You can use bpy.context.window.screen = bpy.data.screens['screen_name']. To see all your screen types, run:

for screen in bpy.data.screens:
    print(screen.name) 
$\endgroup$

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.