class_docstr: Widget for proportionally dividing its internal area into a grid.
  
  This widget will automatically set the position and size of child widgets
  according to provided constraints.
  
  Parameters
  ----------
  spacing : int
      Spacing between widgets.
  **kwargs : dict
      Keyword arguments to pass to `Widget`.
code: def _recreate_solver(self):
      self._solver.reset()
      self._var_w = Variable("w_rect")
      self._var_h = Variable("h_rect")
      self._solver.addEditVariable(self._var_w, "strong")
      self._solver.addEditVariable(self._var_h, "strong")
  
      rect = self.rect.padded(self.padding + self.margin)
      ymax, xmax = self.grid_size
  
      self._solver.suggestValue(self._var_w, rect.width)
      self._solver.suggestValue(self._var_h, rect.height)
  
      self._solver.addConstraint(self._var_w >= 0)
      self._solver.addConstraint(self._var_h >= 0)
  
      # self._height_stay = None
      # self._width_stay = None
  
      # add widths
      self._width_grid = np.array(
          [
              [
                  Variable("width(x: %s, y: %s)" % (x, y))
                  for x in range(0, xmax)
              ]
              for y in range(0, ymax)
          ]
      )
  
      # add heights
      self._height_grid = np.array(
          [
              [
                  Variable("height(x: %s, y: %s" % (x, y))
                  for y in range(0, ymax)
              ]
              for x in range(0, xmax)
          ]
      )
  
      # setup stretch
      stretch_grid = np.zeros(shape=(xmax, ymax, 2), dtype=float)
      stretch_grid.fill(1)
  
      for _, val in self._grid_widgets.items():
          (y, x, ys, xs, widget) = val
          stretch_grid[x : x + xs, y : y + ys] = widget.stretch
  
      # even though these are REQUIRED, these should never fail
      # since they're added first, and thus the slack will "simply work".
      Grid._add_total_width_constraints(
          self._solver, self._width_grid, self._var_w
      )
      Grid._add_total_height_constraints(
          self._solver, self._height_grid, self._var_h
      )
  
      try:
          # these are REQUIRED constraints for width and height.
          # These are the constraints which can fail if
          # the corresponding dimension of the widget cannot be fit in the
          # grid.
          Grid._add_gridding_width_constraints(
              self._solver, self._width_grid
          )
          Grid._add_gridding_height_constraints(
              self._solver, self._height_grid
          )
      except UnsatisfiableConstraint:
          self._need_solver_recreate = True
  
      # these are WEAK constraints, so these constraints will never fail
      # with a RequiredFailure.
      Grid._add_stretch_constraints(
          self._solver,
          self._width_grid,
          self._height_grid,
          self._grid_widgets,
          self._widget_grid,
      )
  
      Grid._add_widget_dim_constraints(
          self._solver,
          self._width_grid,
          self._height_grid,
          self._var_w,
          self._var_h,
          self._grid_widgets,
      )
  
      self._solver.updateVariables()
  
imports: from __future__ import division
  import numpy
  from vispy.geometry import Rect
  from .widget import Widget
  from .viewbox import ViewBox
  from kiwisolver import Solver, Variable, UnsatisfiableConstraint
label_desc: Use image node_id 19 for calling the Grid obj's underlying member method code with example usage: obj._recreate_solver() without return types