Following lv_micropython README in Windows/WSL Unix port results in Segmentation fault

Hi,

I might be asking for trouble by starting with Windows, but here goes. I wanted to try out LVGL in the Micropython Unix port as the web simulator (which is amazing) is a bit clunky to use.

I followed the README at https://github.com/lvgl/lv_micropython and got to the REPL prompt.
I then typed in the lines under “Super Simple Example”. When I got to disp_drv.register() I got a Segmentation fault.

Would appreciate any suggestions for debugging or just letting me know if I am trying to do something impossible. Thanks!

 MicroPython v1.19.1-652-g7dc70db3a on 2022-10-08; linux [GCC 9.3.0] version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import SDL
>>> SDL.init()
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
>>> draw_buf = lv.disp_draw_buf_t()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'lv' isn't defined
>>> import lvgl as lv
>>> draw_buf = lv.disp_draw_buf_t()
>>> buf1_1 = bytearray(480*10)
>>> draw_buf.init(buf1_1, None, len(buf1_1)//4)
>>> disp_drv = lv.disp_drv_t()
>>> disp_drv.init()
>>> disp_drv.draw_buf = draw_buf
>>> disp_drv.f
flush_is_last   full_refresh    flush_cb        flush_ready
>>> disp_drv.flush_cb = SDL.monitor_flush
>>> disp_drv.hor_res = 480
>>> disp_drv.ver_res = 320
>>> disp_drv.re
render_start_cb                 register
>>> disp_drv.register()
Segmentation fault

(I just found that what I wanted to do is actually possible in Gui Guider - I know it is not officially part of LVGL but it looks super good for just exploring what LVGL can do, would be worth mentioning in the docs I think!)

OK by comparing to the Gui Guider code I found that I had missed the lv.init(). With including that I do not get a seg fault so all good, my bad. :slight_smile: Thanks.

Good to know lv_micropython works with WSL!
How do you display graphics? Does WSL support SDL natively? Or do you use X-Windows?

The GUI doesn’t pop up, I more meant the program at least runs. Display should work on windows 11 - Run Linux GUI apps with WSL | Microsoft Learn - but I am on windows 10, have to wait for my work to upgrade me.

Display can work with Windows 10 through x11. See Setup X11 for Window Sub System Linux 2 for GUI | by ⚗ Kevin Summersill 🔋 | Medium

Hm. I tried following those instructions but WSL still didn’t want to show me any GUI, and I am sure it is a deep rabbit hole of debugging to resolve it, so I am going to back away to keep looking at LVGL and not the pile of yaks. :slight_smile: