How to hide panels with python? I want to make quick hiding for better viewing.

Here is what I want to hide:

enter image description here


3 Answers 3


Currently the Python API can't handle opening and closing panels (it's not exposed).

Related: Is it possible to expand/collapes all panels in a region with a keystroke or shortcut?

The only thing you can do with python is to toggle by calling operators:


They need the right context though, so they need to be called from the 3dview area or the context needs to be overwritten. This will toggle all panels in all 3d_views inside window:

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        context_copy = bpy.context.copy()
        context_copy['area'] = area
  • 1
    $\begingroup$ no way to know if one is open or closed ? $\endgroup$
    – Fox
    Jun 10, 2019 at 20:15
  • $\begingroup$ Added an answer to test if they are already open or not. $\endgroup$
    – Way2Close
    Jun 18, 2019 at 20:01

Here is a way to check if they are currently open, you simply test how wide they are, also suggest storing a variable if you intend to untoggle it "toggle_properties = True" for a modal so you don't have to test again.

# hide 'T' and 'N' panels
for r in bpy.context.area.regions:
    if r.type == 'UI':
        if r.width > 1:
            toggle_properties = True

    elif r.type == 'TOOLS':
        if r.width > 1:
            toggle_tools = True

You don't need python to quickly hide. Just make sure your mouse is in 3D view zone and press N to hide/unhide right panel and T to hide/unhide left panel. But, if you need full 3D view, you can select that layout on the top...

  • 1
    $\begingroup$ I need to do it with python! Not shortcuts. $\endgroup$
    – mifth
    Jan 26, 2015 at 13:07
  • $\begingroup$ Why? Are you making a addon or something? Otherwise I don't see point of it... $\endgroup$ Jan 26, 2015 at 13:37
  • 6
    $\begingroup$ @AdriansNetlis Probably an addon yes, you can suggest alternatives but he asked for a way with python whether you see the point or not. $\endgroup$
    – iKlsR
    Jan 26, 2015 at 13:44
  • $\begingroup$ I know it's been 5 years, but you can enter full screen mode (ctrl+alt+space), I'm am looking for a way to do this from python, but I think that doable $\endgroup$
    – DrDress
    Jan 7, 2021 at 9:08

You must log in to answer this question.

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