Orientation change with TFT Simulator


What MCU/Processor/Board and compiler are you using?

TFT Simulator within linux environment

What LVGL version are you using?

Should be v7.10.1 within lv_micropython -> lv_binding

What do you want to achieve?

I want to be able to use the TFT Simulator in portrait mode

What have you tried so far?

I have tried to simply swap hor_res and ver_res + adjust buf1_1 but this results in the same sized TFT Simulator window as before, just the space on the right is missing and painted black, since I’ve reduced the hor_res, and all the widgets seem to be centered according to the new ver_res aswell

Code to reproduce

I am using the code from an example and guess it doesn’t matter if it’s in c or python in this case.
I simply feel lost, because I don’t know what I’m doing, how do I have to adjust this code in order to use the TFT Simulator in portrait mode (hor_res : 320, ver_res: 480 )?

import SDL

disp_buf1 = lv.disp_buf_t()
buf1_1 = bytes(480*10)
disp_buf1.init(buf1_1, None, len(buf1_1)//4)
disp_drv = lv.disp_drv_t()
disp_drv.buffer = disp_buf1
disp_drv.flush_cb = SDL.monitor_flush
disp_drv.hor_res = 480
disp_drv.ver_res = 320

Best regards

I think you also need to pass a width and height to SDL.init. It should be something like SDL.init(w=320,h=480).

1 Like

Thank you very much! This solved it