Skip to content

Set border property upon construction #3269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ipywidgets/widgets/widget_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class Layout(Widget):
- ``flex-wrap`` and ``flex-direction`` are bound to ``flex-flow``.
- ``margin-[top/bottom/left/right]`` values are bound to ``margin``, etc.
"""

_view_name = Unicode('LayoutView').tag(sync=True)
_view_module = Unicode('@jupyter-widgets/base').tag(sync=True)
_view_module_version = Unicode(__jupyter_widgets_base_version__).tag(sync=True)
Expand Down Expand Up @@ -78,6 +77,14 @@ class Layout(Widget):
grid_column = Unicode(None, allow_none=True, help="The grid-column CSS attribute.").tag(sync=True)
grid_area = Unicode(None, allow_none=True, help="The grid-area CSS attribute.").tag(sync=True)

def __init__(self, **kwargs):
if 'border' in kwargs:
border = kwargs.pop('border')
for side in ['top', 'right', 'bottom', 'left']:
kwargs.setdefault(f'border_{side}', border)

super().__init__(**kwargs)

def _get_border(self):
"""
`border` property getter. Return the common value of all side
Expand Down