code: def draw(self):
          
  
          # Content is only rendered within rect
          self.context.save()
          self.context.rectangle(*self.rect)
          self.context.clip()
  
          content = self.get_cell_content()
  
          pos_x, pos_y = self.rect[:2]
          self.context.translate(pos_x + 2, pos_y + 2)
  
          cell_attributes = self.code_array.cell_attributes
  
          # Do not draw cell content if cell is too small
          # This allows blending out small cells by reducing height to 0
  
          if self.rect[2] < cell_attributes[self.key]["borderwidth_right"] or \
             self.rect[3] < cell_attributes[self.key]["borderwidth_bottom"]:
              self.context.restore()
              return
  
          if self.code_array.cell_attributes[self.key]["button_cell"]:
              # Render a button instead of the cell
              label = self.code_array.cell_attributes[self.key]["button_cell"]
              self.draw_button(1, 1, self.rect[2]-5, self.rect[3]-5, label)
  
          elif isinstance(content, wx._gdi.Bitmap):
              # A bitmap is returned --> Draw it!
              self.draw_bitmap(content)
  
          elif pyplot is not None and isinstance(content, pyplot.Figure):
              # A matplotlib figure is returned --> Draw it!
              self.draw_matplotlib_figure(content)
  
          elif isinstance(content, basestring) and is_svg(content):
              # The content is a vaid SVG xml string
              self.draw_svg(content)
  
          elif content is not None:
              self.draw_text(content)
  
          self.context.translate(-pos_x - 2, -pos_y - 2)
  
          # Remove clipping to rect
          self.context.restore()
docs: Draws cell content to context