Hi,
I was a bit frustrated with the documentation of the UI elements, so I started digging. I wanted to share the information I found with other beginners like me so they won't need to spend the 2-3 hours I did spend to set the border colour of a button.
Trick 1: you need to understand that the M5stack_ui are basically the micropython bindings of LVGL (version 7). This means whatever you need to know, you can find in the LVGL documentation.
Trick 2: as the documentation of the python modules on the M5Stack page is incomplete, it helps to inspect the actually implemented functions by using something like:
btn = M5Btn()
print(dir(btn))
which returns:
['class', 'init', 'module', 'qualname', 'dict', 'cb', 'delete', 'get_state', 'obj', 'set_align', 'set_bg_color', 'set_cb', 'set_hidden', 'set_pos', 'set_size', 'style', 'set_btn_text', 'set_btn_text_color', 'set_btn_text_font', 'pressed', 'released', 'callback', 'btn_text', 'btn_label_obj'
This shows, for example, that there is actualy the function set_btn_text implemented (which is not documented), and that we have the "obj" attribute which allows us to modify all of the objects parameters.
Result:
As an example, to create a button with a specific corner radius and the border colour set, you need to create a style, set the parameters of the style and the apply the style to the object:
btn = M5Btn(text="--", x=180, y=70,w= 120, h=100, bg_c=UI_BTN_CLR ,text_c=UI_TEXT_COLOUR ,font=FONT_MONT_38)
se_style = lv.style_t() # create the style
se_style.set_border_color(lv.STATE.DEFAULT,lv.color_hex6(UI_BTN_CLR))
se_style.set_radius(lv.STATE.DEFAULT,8)
btn.obj.add_style(btn.obj.PART.MAIN,se_style) # add it to the btn parent object
Hope this is helpful to somebody (even though no one asked...)