0
$\begingroup$

I want to use bpy.context.workspace.status_text_set(text="HelloWorld")

The problem is it is working just in draw, modal, execute methods of my operators, but I want to change it from class which not inherited from bpy.types.Operator in this class bpy.context.workspace is None

$\endgroup$

1 Answer 1

2
$\begingroup$

Problem solved with global variable and function which registered as blender timer.

status = {'prev': None, 'new': None}


def set_status(text):
    try:
        status.update({'prev': status['new'],
                       'new': text})
    except:
        pass


def status_timer():
    try:
        if status['new'] != status['prev']:
            bpy.context.workspace.status_text_set(text=status['new'])
        return 1
    except Exception as e:
        return None

and add to register() function bpy.app.timers.register(status_timer)

$\endgroup$
3
  • 1
    $\begingroup$ Great you solved it, but more details please. $\endgroup$ Commented Nov 18, 2020 at 13:04
  • $\begingroup$ Is this missing a call to set_status? $\endgroup$
    – batFINGER
    Commented Nov 18, 2020 at 16:23
  • $\begingroup$ you can call set_status everywhere you want text: text for status, type=string $\endgroup$
    – Sofia
    Commented Nov 19, 2020 at 14:06

You must log in to answer this question.

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