All possible callbacks
Prints to console when callbacks fired
So much info in the python console, autocomplete on draw handler add. Will see that
args is a tuple of arguments passed to the callback method. Error in question was passing 1 arg to a method with none. Will show up in system console as an error.
draw_handler_add(callback, args, region_type, draw_type)
.. method:: draw_handler_add(callback, args, region_type, draw_type)
Add a new draw handler to this space type.
It will be called every time the specified region in the space type will be drawn.
Note: All arguments are positional only for now.
A function that will be called when the region is drawn.
It gets the specified arguments as input.
:type callback: function
:param args: Arguments that will be passed to the callback.
:type args: tuple
:param region_type: The region type the callback draws in; usually ``WINDOW``. (:class:`bpy.types.Region.type`)
:type region_type: str
:param draw_type: Usually ``POST_PIXEL`` for 2D drawing and ``POST_VIEW`` for 3D drawing. In some cases ``PRE_VIEW`` can be used. ``BACKDROP`` can be used for backdrops in the node editor.
:type draw_type: str
:return: Handler that can be removed later on.
Attempt to add every draw call back possible. Has to be a redraw of the type specified to fire the callback. I doesn't relentlessly fire.
from bpy.types import SpaceView3D, Region
def __init__(self, context):
for rt in Region.bl_rna.properties['type'].enum_items.keys():
for d in ('POST_PIXEL', 'POST_VIEW', 'PRE_VIEW', 'BACKDROP'):
self.dcb, (rt, d,), rt, d)
print("No dcb for", rt, d)
def dcb(self, rt, d):
print("Testing dcb:", rt, d)
if __name__ == "__main__":