@@ -64,8 +64,10 @@ def show(self, widget):
64
64
An LTK Python widget of class <tt>{ widget .__class__ .__name__ } </tt><ul>
65
65
<li>{ widget .__class__ .__doc__ .replace ("<" , "<" )}
66
66
{ self .get_attrs (widget )}
67
+ { self .get_classes (widget )}
67
68
<li>{ self .get_creation_link (widget )}
68
69
<li>{ widget .children ().length } children
70
+ { self .get_css (widget )}
69
71
""" )
70
72
details_left = max (0 , left - self .details .outerWidth () + 2 ) \
71
73
if left + width > find ("body" ).width () * 3 / 4 else left + width - 2
@@ -79,6 +81,20 @@ def hide(self):
79
81
self .right .css ("display" , "none" )
80
82
self .details .css ("display" , "none" )
81
83
84
+ def get_css (self , widget ):
85
+ """ Show the CSS of a widget """
86
+ js_styles = window .getStyle (widget .element )
87
+ return "<li> css:<pre style='font-size: 12px;'>" + window .JSON .stringify (js_styles , None , 4 ) + "</pre>"
88
+
89
+ def get_classes (self , widget ):
90
+ """ Show the classes of a widget """
91
+ result = []
92
+ for name , value in widget .__class__ .__dict__ .items ():
93
+ if name .startswith ("_" ) or name in INSPECT_IGNORE_ATTRIBUTES :
94
+ continue
95
+ result .append (f"{ name } = { value } " )
96
+ return ("<li>" if result else "" ) + "<li>" .join (result )
97
+
82
98
def get_attrs (self , widget ):
83
99
""" Show the attributes of a widget """
84
100
result = []
0 commit comments