pdwidgets.task

Scheduled repeating tasks for Display.

class pdwidgets.task.Task(callback, delay)[source]

Bases: object

A task that runs a callback function after a specified delay. Used by the Display object to run tasks at regular intervals, such as refreshing the display or updating the clock.

Parameters:
  • callback (callable) – The function to run.

  • delay (int) – The delay in milliseconds before running the callback.

Usage:
def my_callback():

print(“Hello, world!”)

task = Task(my_callback, 1000) # Run my_callback every second display.add_task(task)

run(t)[source]

Run the callback function and set the next run time.

Parameters:

t (int) – The current time in milliseconds.