@@ -64,8 +64,10 @@ def show(self, widget):
6464 An LTK Python widget of class <tt>{ widget .__class__ .__name__ } </tt><ul>
6565 <li>{ widget .__class__ .__doc__ .replace ("<" , "<" )}
6666 { self .get_attrs (widget )}
67+ { self .get_classes (widget )}
6768 <li>{ self .get_creation_link (widget )}
6869 <li>{ widget .children ().length } children
70+ { self .get_css (widget )}
6971 """ )
7072 details_left = max (0 , left - self .details .outerWidth () + 2 ) \
7173 if left + width > find ("body" ).width () * 3 / 4 else left + width - 2
@@ -79,6 +81,20 @@ def hide(self):
7981 self .right .css ("display" , "none" )
8082 self .details .css ("display" , "none" )
8183
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+
8298 def get_attrs (self , widget ):
8399 """ Show the attributes of a widget """
84100 result = []
0 commit comments