In add-on script, how to automatically rewrite string in the bottom statusbar on each edge select/deselect in edit mode I'm trying to write my first add-on that should tell me the summary length of selected edges in edit mode if there are any. I got the part with getting selected edges and counting sum length, but what I am currently struggling to do is

to get add-on invoked on each edge select/deselect

to update the sum value to display result on the bottom statusbar (where the name of the active object, amount of vertices/edges/faces are displayed)
For the first one I guess there could be some sort of callback/delegate that I could assign for every select and deselect to be invoked, but I don't know which to use. For the second I guess (and hope) I just need to know which variable to use.


I'm using blender 2.8.71 beta if that matters.
Thanks
I only answer the second one for you since it is a little bit hard to find. But it is actually very useful in many case.

status_text_set(string)

status_text_set(text) in bpy.types.WorkSpace(ID):


  classmethod status_text_set(text)  
  
  Set the status bar text, typically key shortcuts for modal operators
  
  
  Parameters:    text (string) – Text, New string for the status bar, None clears the text
  


So we can bpy.types.WorkSpace.status_text_set("hello world") to set the status bar, cool.

Or since context got an workspace as well, use context.workspace.status_text_set("foo") will be a better idea when using in operator or function which has it own context. - @batFINGER



Important

Clear the content by assign it a None, or it will keep showing there until next function call. You should consider clear it after you leave your operator.