Simplify Blender GUI using Python I want to use Blender for a specific task where the user (not me) is just presented with a limited set of tools and nothing else.

Using the usual possibilities configuring the GUI lead my quite close to my target. 

Beside that I want the toolbar only contain my tools/buttons. Editing space_view3d_toolbar.py gave me an empty toolbar which I then populate with my own tools.

However I would like to NOT alter Blenders core files and just use a script registered in my startup.blend which does the cleaning. 



So my question is:

How to iterate through the existing Panels (for all modes) on the toolbar and remove them?
To remove panels, you can simply unregister the classes.

Here we remove all View 3D Panels:

import bpy
for pt in bpy.types.Panel.__subclasses__():
    if pt.bl_space_type == 'VIEW_3D':
        bpy.utils.unregister_class(pt)


Of course you may want to do some other checks to only remove some of the panels... try use the Python console to inspect the panel types and see which members are useful to check (__name__ for example)

Note that __subclasses__ is a standard Python method.

This works for other areas too, operators, menu's, (any class which can be registered).



To run Multiple times you need to check if the class has a specific RNA attribute:

import bpy
for pt in bpy.types.Panel.__subclasses__():
    if pt.bl_space_type == 'VIEW_3D':
        if "bl_rna" in pt.__dict__:   # &lt;-- check if we already removed!
            bpy.utils.unregister_class(pt)


Note that this making use of an internal attribute and is not a documented part of the Python API, its used for Blender's own tracking of classes.