I am writing a timer script and I want to get whether Blender is the active window.

this an example code for the timer:

import bpy
import datetime

counter = 0

def update_time():
    global time
    global now
    now = datetime.datetime.now()
    time = bpy.context.scene.timer.time
    bpy.context.scene.timer.time = time + 60
    return 60

def register(): 

I have already seen a script which gets whether Blender is the active window like this:

    if event.type == 'WINDOW_DEACTIVATE':
       window_active = False

But this runs in a modal operator, so my question is, is it possible to do this with bpy.app.timers? I didn't find anything about getting events while in app.timers, is it even possible, or do you know a better way?



You must log in to answer this question.

Browse other questions tagged .