Update the style. Args: style_dict: The style dictionary. kwargs: Other key value pairs to apply to the dict update.
(self, style_dict: dict | None, **kwargs)
| 262 | super().__init__(style_dict) |
| 263 | |
| 264 | def update(self, style_dict: dict | None, **kwargs): |
| 265 | """Update the style. |
| 266 | |
| 267 | Args: |
| 268 | style_dict: The style dictionary. |
| 269 | kwargs: Other key value pairs to apply to the dict update. |
| 270 | """ |
| 271 | if not isinstance(style_dict, Style): |
| 272 | converted_dict = type(self)(style_dict) |
| 273 | else: |
| 274 | converted_dict = style_dict |
| 275 | if kwargs: |
| 276 | if converted_dict is None: |
| 277 | converted_dict = type(self)(kwargs) |
| 278 | else: |
| 279 | converted_dict.update(kwargs) |
| 280 | # Combine our VarData with that of any Vars in the style_dict that was passed. |
| 281 | self._var_data = VarData.merge(self._var_data, converted_dict._var_data) |
| 282 | super().update(converted_dict) |
| 283 | |
| 284 | def __setitem__(self, key: str, value: Any): |
| 285 | """Set an item in the style. |