How to use the kiwisolver.strength.weak function in kiwisolver

To help you get started, we’ve selected a few kiwisolver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nucleic / enaml / enaml / layout / layout_manager.py View on Github external
The best size is computed by invoking the solver with a zero
        size suggestion at a strength of 0.1 * weak. The resulting
        values for width and height are taken as the best size.

        Returns
        -------
        result : tuple
            The 2-tuple of (width, height) best size values.

        """
        d = self._root_item.constrainable()
        width = d.width
        height = d.height
        solver = self._solver
        strength = 0.1 * kiwi.strength.weak
        pairs = ((width, strength), (height, strength))
        with self._edit_context(pairs):
            solver.suggestValue(width, 0.0)
            solver.suggestValue(height, 0.0)
            solver.updateVariables()
            result = (width.value(), height.value())
        return result

kiwisolver

A fast implementation of the Cassowary constraint solver

BSD-3-Clause
Latest version published 8 months ago

Package Health Score

86 / 100
Full package analysis

Similar packages