@@ -309,16 +309,19 @@ def flush(self):
309309 self ._commands_cache = []
310310 self ._buffers_cache = []
311311
312- @observe ('fill_style' , 'stroke_style' , 'global_alpha' , 'font' , 'text_align' ,
313- 'text_baseline' , 'direction' , 'global_composite_operation' ,
314- 'line_width' , 'line_cap' , 'line_join' , 'miter_limit' , 'line_dash_offset' )
315- def _on_set_attr (self , change ):
316- command = {
317- 'name' : 'set' ,
318- 'attr' : to_camel_case (change .name ),
319- 'value' : change .new
320- }
321- self ._send_command (command )
312+ def __setattr__ (self , name , value ):
313+ super (Canvas , self ).__setattr__ (name , value )
314+
315+ canvas_attrs = ['fill_style' , 'stroke_style' , 'global_alpha' , 'font' , 'text_align' ,
316+ 'text_baseline' , 'direction' , 'global_composite_operation' ,
317+ 'line_width' , 'line_cap' , 'line_join' , 'miter_limit' , 'line_dash_offset' ]
318+ if name in canvas_attrs :
319+ command = {
320+ 'name' : 'set' ,
321+ 'attr' : to_camel_case (name ),
322+ 'value' : value
323+ }
324+ self ._send_command (command )
322325
323326 def _send_canvas_command (self , name , args = [], buffers = []):
324327 command = {
0 commit comments