Improve widget info debug print

This commit is contained in:
Thomas Farstrike
2025-10-20 12:33:45 +02:00
parent 3fef5dd84d
commit 0a061b898e
+5 -2
View File
@@ -16,14 +16,17 @@ def print_lvgl_widget(obj, depth=0):
if obj:
label = ""
hidden = ""
editable = "editable"
obj_area = lv.area_t()
obj.get_coords(obj_area)
if obj.has_flag(lv.obj.FLAG.HIDDEN):
hidden = "hidden "
if not obj.is_editable():
editable = "not editable "
if isinstance(obj,lv.label):
label = f" has label '{obj.get_text()}'"
label = f" with label '{obj.get_text()}'"
padding = " " * depth
print(f"{padding}{hidden}{obj} with abs position {obj_area.x1}x{obj_area.y1} and size {obj_area.get_width()}x{obj_area.get_height()}{label}")
print(f"{padding}{obj} pos:{obj_area.x1}x{obj_area.y1} size:{obj_area.get_width()}x{obj_area.get_height()} {hidden}{editable} {label}")
for childnr in range(obj.get_child_count()):
print_lvgl_widget(obj.get_child(childnr), depth+1)
else: