I would like to make a 7 minute timer, but I'm new to scripting and don't know how to. So can anyone help by sending a script that I could use.


2 Answers 2


Depends what you mean when you say timer. If you want a timer during your animation your best bet is to just calculate the corresponding keyframe. If you mean just a generic timer, the easiest way from within python is with threading.

import threading

def foo():
    print("times up")

timer = threading.Timer(7*60, foo)

see https://docs.python.org/3/library/threading.html#timer-objects for more details


Here's my script. Just make a text object called "timer", then run this script from the text editor. Note that you can change the duration of the timer by editing the START_TIME value at the bottom.

import bpy

def get_playback_time():
    Convert the current frame to seconds of playback time
    scene = bpy.context.scene

    fps = scene.render.fps  / scene.render.fps_base
    frame = scene.frame_current

    return frame / fps

def seconds_to_timecode(sec):
    Makes a timecode of the format MM:SS from seconds

    minutes = "%02d" % int(sec / 60)
    seconds = "%02d" % int(sec % 60)

    return ''.join([minutes, ':', seconds])

def set_clock(scene):
    Looks for a text object called 'timer' and sets it's text to the 
    start_time - current time
    global START_TIME

    current_time = get_playback_time()

    secs = START_TIME - current_time

    if secs > 0:
        timecode = seconds_to_timecode(secs)
        timecode = '00:00'

    obj = scene.objects['timer']
    obj.data.body = timecode

if __name__ == "__main__":
    START_TIME = 60 * 7

You must log in to answer this question.

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