Get pixel width of scrollbars?

Is there any way to get the pixel width of scrollbars in the ‘WINDOW’ region of an area? Whatever the DPI setting is in user preferences?

The DPI to pixels formula is:

U.widget_unit = (U.pixelsize * U.dpi * 20 + 36) / 72;

whereby pixelsize is 2 with Retina displays and 1 in all other cases (can’t be determined via Python).

You can use the DPI value given in the user preferences.

The width that is used by scrollbars is apparently:

#define V2D_SCROLL_WIDTH    (0.85f * U.widget_unit)


0.85 * ((1 * 72 * 20 + 36) / 72) = 17.425

which is probably clamped (or rounded?) to int, so it should be 17 pixels @72 dpi

Thanks! Didn’t know if there was anything exposed via python or not. That define was in UI_view2d.h and the widget_unit calc was in blender.c… I really need to start digging in the source, but I am still very unfamiliar with it.