LVGL CPython wrapper

Hello, I am 50% complete with an CPython implementation of LVGL. I decided to use ctypes as its easiest to maintain and requires zero dependencies beyond LVGL itself. All that is required is compiling LVGL into a shared library. Right now I have the frame buffer (Linux) and GTK driver wrapped and working. I also have 50% of the widgets wrapped. My motivation is for in-house embedded industrial controller front-ends. I know there is a micropython library and I don’t know what the plans are for CPython support. So I thought I would gauge interest to determine the level of documentation and performance testing needed.

1 Like

Hi @gabewillen!

It’s good to hear! Good luck!

You should know that in the past there was already an effort for providing “regular” Python API to LVGL, in addition to Micropython:

Unfortunately, this effort did not last and the binding scripts were not maintained.
I think the author hit some issues with memory handling (reference counting), and probably didn’t have enough free time to continue with it.
But you can surely learn from his code and the discussions we had at the time!

Some questions:

  • Are you wrapping the widgets manually? Or did you build some script to create the bindings automatically?

  • Are you also wrapping struct access, or only functions?

  • How are you handling memory management?

  • How are you handling callbacks? (like buttons click events etc.)

Dear gabewillen,

this sounds really awesome! :+1: I’ve been looking for something like that for ages and would be happy to use it on my Raspberry Pi! Are you planning to upload your code to Github?