You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a custom widget by deriving it from a base LVGL object
class SpinLabel(lv.label):
def __init__(self, parent):
super().__init__(parent)
self.add_flag(lv.obj.FLAG.SCROLLABLE)
self.set_user_data(self)
When trying to style the object in a custom theme's onApply callback is there any way to determine if the object is my custom widget and if so, how do I cast it to that object type so that I can access it's methods? So far, it seems only the base lv.label type is accessible and even if I check the id() of the created custom object vs the id() of the obj in the theme callback, the two IDs are different.
class sdLvglTheme(lv.theme_t):
....
def apply(self, theme, obj):
#print(obj.get_class())
#print(obj.get_class() == lv.label_class)
try:
#SpinLabel.__cast__(obj).setValue(2)
if (obj.get_class() == lv.label_class):
s = lv.label.__cast__(obj)
s.set_text("2")
print(s)
#s.setValue(2)
a = obj.get_user_data().__dereference__(3)
print(bytes(a))
except Exception as e:
print(e)
The text was updated successfully, but these errors were encountered:
I have created a custom widget by deriving it from a base LVGL object
When trying to style the object in a custom theme's
onApply
callback is there any way to determine if the object is my custom widget and if so, how do I cast it to that object type so that I can access it's methods? So far, it seems only the baselv.label
type is accessible and even if I check theid()
of the created custom object vs theid()
of theobj
in the theme callback, the two IDs are different.The text was updated successfully, but these errors were encountered: