Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
""" A spacer which represents a flexible space with a minimum value.
"""
def constraints(self, first, second):
""" A constraint of the form: (second - first) >= size
"""
return [(second - first) >= self.size]
class FlexSpacer(Spacer):
""" A spacer with a hard minimum and a preference for that minimum.
"""
#: The strength for the minimum space constraint.
min_strength = StrengthMember(kiwi.strength.required)
#: The strength for the equality space constraint.
eq_strength = StrengthMember(kiwi.strength.medium * 1.25)
def __init__(self, size, min_strength=None, eq_strength=None):
""" Initialize a FlexSpacer.
Parameters
----------
size : int
The basic size of the spacer, in pixels >= 0.
min_strength : strength-like, optional
The strength to apply to the minimum spacer size. The
default is kiwi.strength.required.