How to use get_inactive_time() in Micropython

I’ve been searching all over to find a way to use lv_disp_get_inactive_time(disp) in Micropython. Can’t find it.

I’m using the T-watch-2020 esp32 microcontroller v1.

I currently have below:
import lvgl as lv

if lv.disp_get_inactive_time > 2000:

Above does not work.
Should it be inside a particular function? I don’t have a reference for the Micropython binding.

Please help.

disp = lv.disp_get_default()
t = disp.get_inactive_time()

Docs covers most Micropython functionality, with many Micropython examples. See
The docs are oriented for the C audience, but for specific Python functionality you can also try “help” with specific class, object, or the entire lv module.

For example:

>>> help(disp)
object struct lv_disp_t is of type lv_disp_t
  __SIZE__ -- 348
  __cast__ -- <classmethod>
  __cast_instance__ -- <function>
  __dereference__ -- <function>
  dpx -- <function>
  drv_update -- <function>
  remove -- <function>
  set_default -- <function>
  get_hor_res -- <function>
  get_ver_res -- <function>
  get_antialiasing -- <function>
  get_dpi -- <function>
  set_rotation -- <function>
  get_rotation -- <function>
  get_next -- <function>
  get_draw_buf -- <function>
  get_scr_act -- <function>
  get_scr_prev -- <function>
  get_layer_top -- <function>
  get_layer_sys -- <function>
  set_theme -- <function>
  get_theme -- <function>
  set_bg_color -- <function>
  set_bg_image -- <function>
  set_bg_opa -- <function>
  get_inactive_time -- <function>
  trig_activity -- <function>
  clean_dcache -- <function>

Got it.
On my ttgo twatch-2020 it should be:


Better use the object instead of the class.

So instead of using lv.disp_t you can use the disp object itselt:


That is better.
Thx for the tip.