@@ -49,6 +49,7 @@ def __init__(self, *args):
49
49
.append (* self ._flatten (args ))
50
50
)
51
51
self ._handle_css (args )
52
+ args = self ._flatten (args )
52
53
53
54
def _handle_css (self , args ):
54
55
"""Apply CSS styles passed in the args to the widget.
@@ -364,7 +365,7 @@ def __getattr__(self, name):
364
365
try :
365
366
return getattr (self .element , name )
366
367
except Exception as e :
367
- raise AttributeError (f"ltk. { self .__class__ .__name__ } does not have attribute { name } " ) from e
368
+ raise AttributeError (f"Widget { self .__class__ .__name__ } does not have attribute { name } " ) from e
368
369
369
370
def toJSON (self , * args ): # pylint: disable=invalid-name
370
371
""" Return a JSON representation of the widget """
@@ -737,7 +738,8 @@ class Link(Text):
737
738
tag = "a"
738
739
739
740
def __init__ (self , href , * items ):
740
- Text .__init__ (self , * items )
741
+ Text .__init__ (self )
742
+ self .append (* items )
741
743
self .attr ("href" , href )
742
744
self .attr ("target" , "_blank" )
743
745
@@ -941,13 +943,13 @@ class TableRow(Widget):
941
943
tag = "tr"
942
944
943
945
944
- class TableHeader (Text ):
946
+ class TableHeader (Widget ):
945
947
""" Wraps an HTML element of type <th> """
946
948
classes = [ "ltk-th" ]
947
949
tag = "th"
948
950
949
951
950
- class TableData (Text ):
952
+ class TableData (Widget ):
951
953
""" Wraps an HTML element of type <td> """
952
954
classes = [ "ltk-td" ]
953
955
tag = "td"
@@ -1218,6 +1220,7 @@ class Select(Widget):
1218
1220
1219
1221
def __init__ (self , options , selected , handler = None , style = None ):
1220
1222
Widget .__init__ (self , [Option (text ) for text in options ], style )
1223
+ assert isinstance (options , list ), f"Select: Expected options to be a list, not { type (options )} "
1221
1224
self .options = options
1222
1225
self .handler = handler
1223
1226
self .set_value (selected )
@@ -1393,7 +1396,7 @@ def __getattr__(self, name):
1393
1396
try :
1394
1397
return getattr (self .context , name )
1395
1398
except : # pylint: disable=bare-except
1396
- error = f"LTK widget { self } does not have attribute { name } "
1399
+ error = f"Widget { self } does not have attribute { name } "
1397
1400
raise AttributeError (error ) # pylint: disable=raise-missing-from
1398
1401
1399
1402
def __setattr__ (self , name , value ):
0 commit comments