AttributeError: 'NoneType' object has no attribute 'set_theme'

micropython 1.19.1 error any build problem ???

Hello!
The problem is in ui.py file, line 11, so please send the code from line 1 to 11.
I usually get this "NoneType" object has no attribute '...', when a variable is not set.
In your case I assume you wanted to call the function on display object (which should be set by as: x=lv.disp_get_default() )

Hello,
I have the same problem. I created a testproject in squareline studio an copied ui.py and ui_images.py to my esp32-device.
Here is the error:

MPY: soft reboot
Traceback (most recent call last):
  File "main.py", line 11, in <module>
AttributeError: 'NoneType' object has no attribute 'set_theme'
MicroPython v1.19.1-881-gcae7a7c73-dirty on 2023-10-10; ESP32S3 module (spiram) with ESP32S3

Here is the code:

# This file was generated by SquareLine Studio
# SquareLine Studio version: SquareLine Studio 1.4.0
# LVGL version: 8.3.11
# Project name: SquareLine_Project

import lvgl as lv
import ui_images

dispp = lv.disp_get_default()
theme = lv.theme_default_init(dispp, lv.palette_main(lv.PALETTE.BLUE), lv.palette_main(lv.PALETTE.RED), False, lv.font_default())
dispp.set_theme(theme)

_ui_theme_color_Default = [0xE8A8A8]
_ui_theme_alpha_Default = [255]

_ui_theme_list_colors = [_ui_theme_color_Default]
_ui_theme_list_alphas = [_ui_theme_alpha_Default]

ui_theme_current_colors=[]

ui_theme_current_alphas=[]



UI_THEME_DEFAULT = 0
UI_THEME_COLOR_ROT = 0
# THEME MANAGER

ui_local_style_list = {}

class _ui_theme_variable:
    def __init__(self):
        self.target = None
        self.color = 0

def ui_object_set_themeable_style_property(target, selector, property, coloridx):

   if not (id(target) in ui_local_style_list):
      ui_local_style_list[id(target)] = {}

   if not property in ui_local_style_list[id(target)]:
      ui_local_style_list[id(target)][property] = {}

   ui_local_style_list[id(target)][property][selector] = _ui_theme_variable()
   ui_local_style_list[id(target)][property][selector].target = target
   ui_local_style_list[id(target)][property][selector].color = coloridx
   ui_update_theme_value( target, property, selector )

def ui_update_theme_value(target, property, selector):

   if not (id(target) in ui_local_style_list):
       return

   if not property in ui_local_style_list[id(target)]:
       return

   if not selector in ui_local_style_list[id(target)][property]:
       return

   coloridx = ui_local_style_list[id(target)][property][selector].color
   color = lv.style_value_t()

   if (property ==  lv.STYLE.BG_COLOR or
          property == lv.STYLE.BG_GRAD_COLOR or
          property == lv.STYLE.BORDER_COLOR or
          property == lv.STYLE.OUTLINE_COLOR or
          property == lv.STYLE.TEXT_COLOR or
          property == lv.STYLE.LINE_COLOR or
          property == lv.STYLE.ARC_COLOR or
          property == lv.STYLE.SHADOW_COLOR or
          property == lv.STYLE.BG_IMG_RECOLOR or
          property == lv.STYLE.IMG_RECOLOR ):
      color.color = lv.color_hex(ui_theme_current_colors[coloridx])
   else: color.num = ui_theme_current_alphas[coloridx]
   target.set_local_style_prop(property,color,selector)

def ui_theme_manager_reset():
   ui_local_style_list = {}

def ui_theme_update_all():
   for obj in ui_local_style_list:
      targetid = obj
      proplist = ui_local_style_list[obj]
      for prop in proplist:
         lvprop = prop
         selectlist = ui_local_style_list[obj][prop]
         for select in selectlist:
            lvselect = select
            target = ui_local_style_list[obj][prop][lvselect].target
            ui_update_theme_value(target, lvprop,lvselect)

def ui_theme_set( index ):
   global ui_theme_current_colors
   global ui_theme_current_alphas
   ui_theme_current_colors = _ui_theme_list_colors[index]
   ui_theme_current_alphas = _ui_theme_list_alphas[index]
   ui_theme_update_all()

ui_theme_manager_reset()



ui_theme_set(UI_THEME_DEFAULT)

def SetFlag( obj, flag, value):
    if (value):
        obj.add_flag(flag)
    else:
        obj.clear_flag(flag)
    return

_ui_comp_table = {}
_ui_comp_prev = None
_ui_name_prev = None
_ui_child_prev = None
_ui_comp_table.clear()

def _ui_comp_del_event(e):
    target = e.get_target()
    _ui_comp_table[id(target)].remove()

def ui_comp_get_child(comp, child_name):
    return _ui_comp_table[id(comp)][child_name]

def ui_comp_get_root_from_child(child, compname):
    for component in _ui_comp_table:
        if _ui_comp_table[component]["_CompName"]==compname:
            for part in _ui_comp_table[component]:
                if id(_ui_comp_table[component][part]) == id(child):
                    return _ui_comp_table[component]
    return None
def SetBarProperty(target, id, val):
   if id == 'Value_with_anim': target.set_value(val, lv.ANIM.ON)
   if id == 'Value': target.set_value(val, lv.ANIM.OFF)
   return

def SetPanelProperty(target, id, val):
   if id == 'Position_X': target.set_x(val)
   if id == 'Position_Y': target.set_y(val)
   if id == 'Width': target.set_width(val)
   if id == 'Height': target.set_height(val)
   return

def SetDropdownProperty(target, id, val):
   if id == 'Selected':
      target.set_selected(val)
   return

def SetImageProperty(target, id, val, val2):
   if id == 'Image': target.set_src(val)
   if id == 'Angle': target.set_angle(val2)
   if id == 'Zoom': target.set_zoom(val2)
   return

def SetLabelProperty(target, id, val):
   if id == 'Text': target.set_text(val)
   return

def SetRollerProperty(target, id, val):
   if id == 'Selected':
      target.set_selected(val, lv.ANIM.OFF)
   if id == 'Selected_with_anim':
      target.set_selected(val, lv.ANIM.ON)
   return

def SetSliderProperty(target, id, val):
   if id == 'Value_with_anim': target.set_value(val, lv.ANIM.ON)
   if id == 'Value': target.set_value(val, lv.ANIM.OFF)
   return

def ChangeScreen( src, fademode, speed, delay):
    lv.scr_load_anim(src, fademode, speed, delay, False)
    return

def DeleteScreen(src):
    return

def IncrementArc( trg, val):
    trg.set_value(trg.get_value()+val)
    lv.event_send(trg,lv.EVENT.VALUE_CHANGED, None)
    return

def IncrementBar( trg, val, anim):
    trg.set_value(trg.get_value()+val,anim)
    return

def IncrementSlider( trg, val, anim):
    trg.set_value(trg.get_value()+val,anim)
    lv.event_send(trg,lv.EVENT.VALUE_CHANGED, None)
    return

def KeyboardSetTarget( keyboard, textarea):
    keyboard.set_textarea(textarea)
    return

def ModifyFlag( obj, flag, value):
    if (value=="TOGGLE"):
        if ( obj.has_flag(flag) ):
            obj.clear_flag(flag)
        else:
            obj.add_flag(flag)
        return

    if (value=="ADD"):
        obj.add_flag(flag)
    else:
        obj.clear_flag(flag)
    return

def ModifyState( obj, state, value):
    if (value=="TOGGLE"):
        if ( obj.has_state(state) ):
            obj.clear_state(state)
        else:
            obj.add_state(state)
        return

    if (value=="ADD"):
        obj.add_state(state)
    else:
        obj.clear_state(state)
    return

def TextAreaMoveCursor( trg, val):
    if val=="UP" : trg.cursor_up()
    if val=="RIGHT" : trg.cursor_right()
    if val=="DOWN" : trg.cursor_down()
    if val=="LEFT" : trg.cursor_left()
    trg.add_state(lv.STATE.FOCUSED)
    return

def set_opacity(obj, v):
    obj.set_style_opa(v, lv.STATE.DEFAULT|lv.PART.MAIN)
    return

def SetTextValueArc( trg, src, prefix, postfix):
    trg.set_text(prefix+str(src.get_value())+postfix)
    return

def SetTextValueSlider( trg, src, prefix, postfix):
    trg.set_text(prefix+str(src.get_value())+postfix)
    return

def SetTextValueChecked( trg, src, txton, txtoff):
    if src.has_state(lv.STATE.CHECKED):
        trg.set_text(txton)
    else:
        trg.set_text(txtoff)
    return

def StepSpinbox( trg, val):
    if val==1 : trg.increment()
    if val==-1 : trg.decrement()
    lv.event_send(trg,lv.EVENT.VALUE_CHANGED, None)
    return

def SwitchTheme(val):
    ui_theme_set(val)
    return

# COMPONENTS
ui____initial_actions0 = lv.obj()

ui_Screen1 = lv.obj()
SetFlag(ui_Screen1, lv.obj.FLAG.SCROLLABLE, False)
ui_object_set_themeable_style_property( ui_Screen1, lv.PART.MAIN | lv.STATE.DEFAULT, lv.STYLE.BG_GRAD_COLOR, UI_THEME_COLOR_ROT)

ui_Arc1 = lv.arc(ui_Screen1)
ui_Arc1.set_width(150)
ui_Arc1.set_height(150)
ui_Arc1.set_x(-299)
ui_Arc1.set_y(-97)
ui_Arc1.set_align( lv.ALIGN.CENTER)
ui_Arc1.set_value(25)
ui_object_set_themeable_style_property( ui_Arc1, lv.PART.MAIN | lv.STATE.DEFAULT, lv.STYLE.BG_COLOR, UI_THEME_COLOR_ROT)
ui_object_set_themeable_style_property( ui_Arc1, lv.PART.MAIN | lv.STATE.DEFAULT, lv.STYLE.BG_OPA, UI_THEME_COLOR_ROT)

lv.scr_load(ui_Screen1)

When I do some things in REPL, I get the same error.

>>> import lvgl as lv
>>> import ui_images
>>> dispp=lv.disp_get_default()
>>> theme = lv.theme_default_init(dispp, lv.palette_main(lv.PALETTE.BLUE), lv.palette_main(lv.PALETTE.RED), False, lv.font_default())
>>> dispp.set_theme(theme)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'set_theme'
>>> print(theme)
struct lv_theme_t
>>> print(dispp)
None
>>> 

please give me some hints.
Greetings
Gerd

That’s because you don’t have a display driver set up.

What display are you using?

Hello,
this is the hardware I use:
https://www.elecrow.com/esp32-display-5-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html

I think, I just need one working script with these squareline generated code to come along with this issue.

they have some examples on elecrow-website. Maybe I need some code from there? But what exactly? This is working. So my display is maybe GT911.

import lvgl as lv
import lv_utils
import tft_config
import gt911
from machine import Pin, I2C
import time


WIDTH = 800
HEIGHT = 480

# tft drvier
tft = tft_config.config()

# touch drvier
i2c = I2C(1, scl=Pin(20), sda=Pin(19), freq=400000)

tp = gt911.GT911(i2c, width=800, height=480)
tp.set_rotation(tp.ROTATION_NORMAL)

lv.init()

if not lv_utils.event_loop.is_running():
    event_loop=lv_utils.event_loop()
    print(event_loop.is_running())

# create a display 0 buffer
disp_buf0 = lv.disp_draw_buf_t()
buf1_0 = bytearray(WIDTH * HEIGHT)
disp_buf0.init(buf1_0, None, len(buf1_0) // lv.color_t.__SIZE__)

# register display driver
disp_drv = lv.disp_drv_t()
disp_drv.init()
disp_drv.draw_buf = disp_buf0
disp_drv.flush_cb = tft.flush
disp_drv.hor_res = WIDTH
disp_drv.ver_res = HEIGHT
# disp_drv.user_data = {"swap": 0}
disp0 = disp_drv.register()
lv.disp_t.set_default(disp0)

# touch driver init
indev_drv = lv.indev_drv_t()
indev_drv.init()
indev_drv.disp = disp0
indev_drv.type = lv.INDEV_TYPE.POINTER
indev_drv.read_cb = tp.lvgl_read
indev = indev_drv.register()

scr = lv.obj()


class CounterBtn():
    def __init__(self, scr):
        self.cnt = 0
        btn = lv.btn(scr)
        btn.set_size(120, 50)
        btn.align(lv.ALIGN.CENTER,0,0)
        btn.add_event_cb(self.btn_event_cb, lv.EVENT.ALL, None)
        label = lv.label(btn)
        label.set_text("Button")
        label.center()

    def btn_event_cb(self, evt):
        code = evt.get_code()
        btn = evt.get_target()
        if code == lv.EVENT.CLICKED:
            self.cnt += 1


        label = btn.get_child(0)
        label.set_text("Button: " + str(self.cnt))


counterBtn = CounterBtn(scr)
lv.scr_load(scr)

try:
    from machine import WDT
    wdt = WDT(timeout=1000)  # enable it with a timeout of 2s
    print("Hint: Press Ctrl+C to end the program")
    while True:
        wdt.feed()
        time.sleep(0.9)
except KeyboardInterrupt as ret:
    print("The program stopped running, ESP32 has restarted...")

the file tft_config defines the pins:

import lcd
import machine

def config():

    tft = lcd.DPI(
        data = (
            machine.Pin(8),  \
            machine.Pin(3),  \
            machine.Pin(46), \
            machine.Pin(9),  \
            machine.Pin(1),  \
            machine.Pin(5),  \
            machine.Pin(6),  \
            machine.Pin(7),  \
            machine.Pin(15), \
            machine.Pin(16), \
            machine.Pin(4),  \
            machine.Pin(45), \
            machine.Pin(48), \
            machine.Pin(47), \
            machine.Pin(21), \
            machine.Pin(14), \
        ), \
        hsync = machine.Pin(39),          \
        vsync = machine.Pin(41),          \
        de = machine.Pin(40),             \
        pclk_pin = machine.Pin(0),       \
        timings = (4, 43, 8, 4, 12, 8), \
        backlight = machine.Pin(2),      \
        pclk = 16000000,          \
        width = 800,                      \
        height = 480
    )
    tft.reset()
    tft.init()
    tft.backlight_on()
    return tft

I tried to copy this into the ui.py - but same error.

import lvgl as lv
import lv_utils
import tft_config
import time
import fs_driver
import gt911
from machine import Pin, I2C

WIDTH = 800
HEIGHT = 480


# tft drvier
tft = tft_config.config()

# touch drvier
i2c = I2C(1, scl=Pin(20), sda=Pin(19), freq=400000)

tp = gt911.GT911(i2c, width=800, height=480)
tp.set_rotation(tp.ROTATION_NORMAL)

lv.init()

greetings Gerd

The micropython binding doesn’t support RGB displays, only SPI displays.

The GT911 is the touch driver not the display driver.

Hello,
the *.py scripts and the *.bin are from elecrow and all works - but not with squareline code.
They also use lvgl objects. down in this site is the zip-file that contains the bin-file and the examples


Greetings
Gerd

That is a custom made firmware. It doesn’t use lv_micropython.

It looks like you need to use the drivers that are included with the firmware and you have to flash the BIN file to the ESP32…

In the zip file there is a folder called driver+firmware. go into that file. there arte 2 files in there, one called gt911.py and the other is tft_config.py. the gt911 file is the driver for the touch. You need to upload that file to your ESP32 after you flash the bin files located in that same folder. The tft_config file doesn’t contain the driver. It only starts the display driver. So you can optionally upload that file and import it then call the config() function or you can copy the contents of the file and add it to your script at the top. The choice is yours.

Stop using thonny. It causes problems. It has some goofy way that it overrides the repl. shutdown thonny and press the reset button on your ESP32

so I have done some looking at the examples.

This should do the trick for ya.

import lvgl as lv
import lv_utils
import tft_config
import gt911
from machine import Pin, I2C


WIDTH = 800
HEIGHT = 480


# tft drvier
tft = tft_config.config()

# touch drvier
i2c = I2C(1, scl=Pin(20), sda=Pin(19), freq=400000)

tp = gt911.GT911(i2c, width=800, height=480)
tp.set_rotation(tp.ROTATION_NORMAL)

lv.init()

if not lv_utils.event_loop.is_running():
    event_loop=lv_utils.event_loop()
    print(event_loop.is_running())

# create a display 0 buffer
disp_buf0 = lv.disp_draw_buf_t()
buf1_0 = bytearray(WIDTH * HEIGHT)
disp_buf0.init(buf1_0, None, len(buf1_0) // lv.color_t.__SIZE__)

# register display driver
disp_drv = lv.disp_drv_t()
disp_drv.init()
disp_drv.draw_buf = disp_buf0
disp_drv.flush_cb = tft.flush
disp_drv.hor_res = WIDTH
disp_drv.ver_res = HEIGHT
# disp_drv.user_data = {"swap": 0}
dispp = disp_drv.register()
lv.disp_t.set_default(dispp)

# touch driver init
indev_drv = lv.indev_drv_t()
indev_drv.init()
indev_drv.disp = dispp
indev_drv.type = lv.INDEV_TYPE.POINTER
indev_drv.read_cb = tp.lvgl_read
indev = indev_drv.register()

theme = lv.theme_default_init(dispp, lv.palette_main(lv.PALETTE.BLUE), lv.palette_main(lv.PALETTE.RED), False, lv.font_default())
dispp.set_theme(theme)

_ui_theme_color_Default = [0xE8A8A8]
_ui_theme_alpha_Default = [255]

_ui_theme_list_colors = [_ui_theme_color_Default]
_ui_theme_list_alphas = [_ui_theme_alpha_Default]

ui_theme_current_colors=[]

ui_theme_current_alphas=[]

UI_THEME_DEFAULT = 0
UI_THEME_COLOR_ROT = 0
# THEME MANAGER

ui_local_style_list = {}

class _ui_theme_variable:
    def __init__(self):
        self.target = None
        self.color = 0

def ui_object_set_themeable_style_property(target, selector, property, coloridx):

   if not (id(target) in ui_local_style_list):
      ui_local_style_list[id(target)] = {}

   if not property in ui_local_style_list[id(target)]:
      ui_local_style_list[id(target)][property] = {}

   ui_local_style_list[id(target)][property][selector] = _ui_theme_variable()
   ui_local_style_list[id(target)][property][selector].target = target
   ui_local_style_list[id(target)][property][selector].color = coloridx
   ui_update_theme_value( target, property, selector )

def ui_update_theme_value(target, property, selector):

   if not (id(target) in ui_local_style_list):
       return

   if not property in ui_local_style_list[id(target)]:
       return

   if not selector in ui_local_style_list[id(target)][property]:
       return

   coloridx = ui_local_style_list[id(target)][property][selector].color
   color = lv.style_value_t()

   if (property ==  lv.STYLE.BG_COLOR or
          property == lv.STYLE.BG_GRAD_COLOR or
          property == lv.STYLE.BORDER_COLOR or
          property == lv.STYLE.OUTLINE_COLOR or
          property == lv.STYLE.TEXT_COLOR or
          property == lv.STYLE.LINE_COLOR or
          property == lv.STYLE.ARC_COLOR or
          property == lv.STYLE.SHADOW_COLOR or
          property == lv.STYLE.BG_IMG_RECOLOR or
          property == lv.STYLE.IMG_RECOLOR ):
      color.color = lv.color_hex(ui_theme_current_colors[coloridx])
   else: color.num = ui_theme_current_alphas[coloridx]
   target.set_local_style_prop(property,color,selector)

def ui_theme_manager_reset():
   ui_local_style_list = {}

def ui_theme_update_all():
   for obj in ui_local_style_list:
      targetid = obj
      proplist = ui_local_style_list[obj]
      for prop in proplist:
         lvprop = prop
         selectlist = ui_local_style_list[obj][prop]
         for select in selectlist:
            lvselect = select
            target = ui_local_style_list[obj][prop][lvselect].target
            ui_update_theme_value(target, lvprop,lvselect)

def ui_theme_set( index ):
   global ui_theme_current_colors
   global ui_theme_current_alphas
   ui_theme_current_colors = _ui_theme_list_colors[index]
   ui_theme_current_alphas = _ui_theme_list_alphas[index]
   ui_theme_update_all()

ui_theme_manager_reset()



ui_theme_set(UI_THEME_DEFAULT)

def SetFlag( obj, flag, value):
    if (value):
        obj.add_flag(flag)
    else:
        obj.clear_flag(flag)
    return

_ui_comp_table = {}
_ui_comp_prev = None
_ui_name_prev = None
_ui_child_prev = None
_ui_comp_table.clear()

def _ui_comp_del_event(e):
    target = e.get_target()
    _ui_comp_table[id(target)].remove()

def ui_comp_get_child(comp, child_name):
    return _ui_comp_table[id(comp)][child_name]

def ui_comp_get_root_from_child(child, compname):
    for component in _ui_comp_table:
        if _ui_comp_table[component]["_CompName"]==compname:
            for part in _ui_comp_table[component]:
                if id(_ui_comp_table[component][part]) == id(child):
                    return _ui_comp_table[component]
    return None
def SetBarProperty(target, id, val):
   if id == 'Value_with_anim': target.set_value(val, lv.ANIM.ON)
   if id == 'Value': target.set_value(val, lv.ANIM.OFF)
   return

def SetPanelProperty(target, id, val):
   if id == 'Position_X': target.set_x(val)
   if id == 'Position_Y': target.set_y(val)
   if id == 'Width': target.set_width(val)
   if id == 'Height': target.set_height(val)
   return

def SetDropdownProperty(target, id, val):
   if id == 'Selected':
      target.set_selected(val)
   return

def SetImageProperty(target, id, val, val2):
   if id == 'Image': target.set_src(val)
   if id == 'Angle': target.set_angle(val2)
   if id == 'Zoom': target.set_zoom(val2)
   return

def SetLabelProperty(target, id, val):
   if id == 'Text': target.set_text(val)
   return

def SetRollerProperty(target, id, val):
   if id == 'Selected':
      target.set_selected(val, lv.ANIM.OFF)
   if id == 'Selected_with_anim':
      target.set_selected(val, lv.ANIM.ON)
   return

def SetSliderProperty(target, id, val):
   if id == 'Value_with_anim': target.set_value(val, lv.ANIM.ON)
   if id == 'Value': target.set_value(val, lv.ANIM.OFF)
   return

def ChangeScreen( src, fademode, speed, delay):
    lv.scr_load_anim(src, fademode, speed, delay, False)
    return

def DeleteScreen(src):
    return

def IncrementArc( trg, val):
    trg.set_value(trg.get_value()+val)
    lv.event_send(trg,lv.EVENT.VALUE_CHANGED, None)
    return

def IncrementBar( trg, val, anim):
    trg.set_value(trg.get_value()+val,anim)
    return

def IncrementSlider( trg, val, anim):
    trg.set_value(trg.get_value()+val,anim)
    lv.event_send(trg,lv.EVENT.VALUE_CHANGED, None)
    return

def KeyboardSetTarget( keyboard, textarea):
    keyboard.set_textarea(textarea)
    return

def ModifyFlag( obj, flag, value):
    if (value=="TOGGLE"):
        if ( obj.has_flag(flag) ):
            obj.clear_flag(flag)
        else:
            obj.add_flag(flag)
        return

    if (value=="ADD"):
        obj.add_flag(flag)
    else:
        obj.clear_flag(flag)
    return

def ModifyState( obj, state, value):
    if (value=="TOGGLE"):
        if ( obj.has_state(state) ):
            obj.clear_state(state)
        else:
            obj.add_state(state)
        return

    if (value=="ADD"):
        obj.add_state(state)
    else:
        obj.clear_state(state)
    return

def TextAreaMoveCursor( trg, val):
    if val=="UP" : trg.cursor_up()
    if val=="RIGHT" : trg.cursor_right()
    if val=="DOWN" : trg.cursor_down()
    if val=="LEFT" : trg.cursor_left()
    trg.add_state(lv.STATE.FOCUSED)
    return

def set_opacity(obj, v):
    obj.set_style_opa(v, lv.STATE.DEFAULT|lv.PART.MAIN)
    return

def SetTextValueArc( trg, src, prefix, postfix):
    trg.set_text(prefix+str(src.get_value())+postfix)
    return

def SetTextValueSlider( trg, src, prefix, postfix):
    trg.set_text(prefix+str(src.get_value())+postfix)
    return

def SetTextValueChecked( trg, src, txton, txtoff):
    if src.has_state(lv.STATE.CHECKED):
        trg.set_text(txton)
    else:
        trg.set_text(txtoff)
    return

def StepSpinbox( trg, val):
    if val==1 : trg.increment()
    if val==-1 : trg.decrement()
    lv.event_send(trg,lv.EVENT.VALUE_CHANGED, None)
    return

def SwitchTheme(val):
    ui_theme_set(val)
    return

# COMPONENTS
ui____initial_actions0 = lv.obj()

ui_Screen1 = lv.obj()
SetFlag(ui_Screen1, lv.obj.FLAG.SCROLLABLE, False)
ui_object_set_themeable_style_property( ui_Screen1, lv.PART.MAIN | lv.STATE.DEFAULT, lv.STYLE.BG_GRAD_COLOR, UI_THEME_COLOR_ROT)

ui_Arc1 = lv.arc(ui_Screen1)
ui_Arc1.set_width(150)
ui_Arc1.set_height(150)
ui_Arc1.set_x(-299)
ui_Arc1.set_y(-97)
ui_Arc1.set_align( lv.ALIGN.CENTER)
ui_Arc1.set_value(25)
ui_object_set_themeable_style_property( ui_Arc1, lv.PART.MAIN | lv.STATE.DEFAULT, lv.STYLE.BG_COLOR, UI_THEME_COLOR_ROT)
ui_object_set_themeable_style_property( ui_Arc1, lv.PART.MAIN | lv.STATE.DEFAULT, lv.STYLE.BG_OPA, UI_THEME_COLOR_ROT)

lv.scr_load(ui_Screen1)

This is an incredibly slow way of rendering to the display but it will work. It is also using twice as much RAM the way that driver is working. I found out how the manufacturer made the firmware and what they are using for a display driver. It’s not very efficient I will say that. This is because the entire display buffer gets copied before it gets sent instead of just letting LVGL write directly to it. That’s gonna slow things down a good bit especially because LVGL is only using a single frame buffer to write to and the size of the display is rather large.