lv_binding_micropython
lv_binding_micropython copied to clipboard
How to update the lvgl bar progressbar percentage when my other py function is running
I compiled lvgl for micropython 1.19.1
How to update the lvgl bar progressbar percentage when my other py function is running
when i call my function - my function alone is running and lvgl progress bar is stuck
Could you please help with an micropython lvgl progress bar updating example
i was searching but I dont see any fitting micropython examples for this
@embeddedt can you point with an example?
@amirgon can correct me, but I believe the solution here is to make sure that your MicroPython code does not block, as LVGL can only run when Python code is not running. If you need to delay without affecting your UI, look into using a system like uasyncio.
How to update the lvgl bar progressbar percentage when my other py function is running
The UI is updated by the Event Loop. By default, the event loop is running only when other Python code is not running. This allows us to run the GUI (and all other parts of the application) on a single thread.
You should usually write event-driven code: never "wait in a loop forever" for example. If there is some task to do, a callback is called and returns as soon as possible in order to return the control to the event loop.
If you have some long-running sequence of command you want to run without blocking the GUI, your options are:
- Break your sequence to shorter event-driven sequences. uasyncio is one way to do it, there are other ways too.
- Run your long-running sequence in a different thread.
- Create your own event loop and call it from your long-running sequence. This is usually more complicated and we don't recommend it.