When I try to set_text in a label inside a timer, the label never update. I have tried this in the browser LVGL/Micropython Simulator, but does not work there too. I have included some print lines in the code for debug, to make sure the timer was working and the prints work ok, but the set_text does not update the label.
The Code Tested in Simulator:
# Initialize
import display_driver
import lvgl as lv
def add_data(timer):
lbl1.set_text('20Mhz')
print(lbl1.get_text())
lv.tick_inc(5)
scr = lv.obj(lv.scr_act()) #Frame Base
scr.set_size(320, 240)
lbl1=lv.label(lv.scr_act())
lbl1.set_width(100)
lbl1.set_pos(10, 10)
lbl1.set_text("10Mhz")
lv.scr_load(scr)
for i in range(1000000):
no_op = 0
print('Pass')
lbl1.set_text('50Mhz')
timer = lv.timer_create(add_data, 10000, None)
Test it in simulator, because in ESP32 using LVGL/Micropython, the same issue occur after a sleep or big loop like in the example.
On ESP32:
print(“Version: “+str(lv.version_major())+”.”+str(lv.version_minor()))
Version: 8.3os.uname()
(sysname=‘esp32’, nodename=‘esp32’, release=‘1.19.1’, version=‘v1.18-1246-g6ebf96a90 on 2022-07-18’, machine=‘ESP32 module with ESP32’)
Does anyone experienced something similar?
Thanks in advance