Args: style (dict, or json str): The style properties to be applied. width (int, str): An optional width for the widget (es. width=10 or width='10px' or width='10%'). height (int, str): An optional height for the widget (es. height=10 or height='10px' or
(self, style=None, *args, **kwargs)
| 878 | def css_position(self): del self.style['position'] |
| 879 | |
| 880 | def __init__(self, style=None, *args, **kwargs): |
| 881 | |
| 882 | """ |
| 883 | Args: |
| 884 | style (dict, or json str): The style properties to be applied. |
| 885 | width (int, str): An optional width for the widget (es. width=10 or width='10px' or width='10%'). |
| 886 | height (int, str): An optional height for the widget (es. height=10 or height='10px' or height='10%'). |
| 887 | margin (str): CSS margin specifier |
| 888 | """ |
| 889 | if style is None: |
| 890 | style = {} |
| 891 | if '_type' not in kwargs: |
| 892 | kwargs['_type'] = 'div' |
| 893 | |
| 894 | super(Widget, self).__init__(**kwargs) |
| 895 | EventSource.__init__(self, *args, **kwargs) |
| 896 | |
| 897 | self.oldRootWidget = None # used when hiding the widget |
| 898 | |
| 899 | if 'margin' in kwargs: |
| 900 | self.css_margin = kwargs.get('margin') |
| 901 | self.set_size(kwargs.get('width'), kwargs.get('height')) |
| 902 | self.set_style(style) |
| 903 | |
| 904 | def set_style(self, style): |
| 905 | """ Allows to set style properties for the widget. |