class_docstr: Analogous to a gridspec, and contained in another LayoutGrid.
class_docstr_tok: ["Analogous","to","a","gridspec",",","and","contained","in","another","LayoutGrid","."]
code: def parent_constraints(self, parent):
      # constraints that are due to the parent...
      # i.e. the first column's left is equal to the
      # parent's left, the last column right equal to the
      # parent's right...
      if not isinstance(parent, LayoutGrid):
          # specify a rectangle in figure coordinates
          hc = [
              self.lefts[0] == parent[0],
              self.rights[-1] == parent[0] + parent[2],
              # top and bottom reversed order...
              self.tops[0] == parent[1] + parent[3],
              self.bottoms[-1] == parent[1],
          ]
      else:
          rows, cols = self.parent_pos
          rows = np.atleast_1d(rows)
          cols = np.atleast_1d(cols)
  
          left = parent.lefts[cols[0]]
          right = parent.rights[cols[-1]]
          top = parent.tops[rows[0]]
          bottom = parent.bottoms[rows[-1]]
          if self.parent_inner:
              # the layout grid is contained inside the inner
              # grid of the parent.
              left += parent.margins["left"][cols[0]]
              left += parent.margins["leftcb"][cols[0]]
              right -= parent.margins["right"][cols[-1]]
              right -= parent.margins["rightcb"][cols[-1]]
              top -= parent.margins["top"][rows[0]]
              top -= parent.margins["topcb"][rows[0]]
              bottom += parent.margins["bottom"][rows[-1]]
              bottom += parent.margins["bottomcb"][rows[-1]]
          hc = [
              self.lefts[0] == left,
              self.rights[-1] == right,
              # from top to bottom
              self.tops[0] == top,
              self.bottoms[-1] == bottom,
          ]
      for c in hc:
          self.solver.addConstraint(c | "required")
  
imports: import itertools
  import kiwisolver
  import logging
  import numpy
  import matplotlib
  import matplotlib.patches
  from matplotlib.transforms import Bbox
label_desc: Use image node_id 7 for calling the LayoutGrid obj's underlying member method code with example usage: obj.parent_constraints(parent) without return types