def draw(self, drawing, canvas, x=0, y=0, showBoundary=rl_config._unset_): """This is the top level function, which draws the drawing at the given location. The recursive part is handled by drawNode.""" self._tracker = StateTracker(defaultObj=drawing) #stash references for ease of communication if showBoundary is rl_config._unset_: showBoundary = rl_config.showBoundary self._canvas = canvas canvas.__dict__['_drawing'] = self._drawing = drawing drawing._parent = None try: #bounding box if showBoundary: canvas.rect(x, y, drawing.width, drawing.height) canvas.saveState() self.initState(x, y) #this is the push() self.drawNode(drawing) self.pop() canvas.restoreState() finally: #remove any circular references try: del self._canvas, self._drawing, canvas._drawing, drawing._parent, self._tracker except: pass
def __init__(self): self._tracker = StateTracker() self.verbose = 0
def __init__(self): self._tracker = StateTracker()
def __init__(self): self._stroke = 0 self._fill = 0 self._tracker = StateTracker()