How do I get the width of the N Properties Panel in the 3D View using the Python API of Blender 2.8?

enter image description here



The screen is made up of areas, each area has an x, y, width, height attribute.

Python console test code:

>>> for a in C.screen.areas:
...     a.type, a.width
('CONSOLE', 931)
('VIEW_3D', 346)
('TEXT_EDITOR', 931)


within each area there are regions. Commonly there are 'HEADER', 'UI', 'TOOLS' and 'WINDOW' regions. For the 'VIEW_3D' region the N panel is region type 'UI'

>>> for a in C.screen.areas:
...     if a.type == 'VIEW_3D':
...         break
>>> a.type

>>> for r in a.regions:
...     r.type, r.width
('HEADER', 931)
('TOOLS', 1)
('UI', 335)
('WINDOW', 931)

If you are writing UI code to go in the N panel then can get the width directly with



Is there a way to determine the left 3D view sidebar's current width with python?

| improve this answer | |
  • $\begingroup$ I would never have thought that this panel is called 'UI'. Thank. $\endgroup$ – Влад Киндюшов Mar 24 '19 at 13:53

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.