original_docstring:  Draw the rectangles and skyline.
docstring: Draw the rectangles and skyline.
docstring_tokens: Draw the rectangles and skyline .
code: def draw(self):
          """ Draw the rectangles and skyline."""
          self.canvas.delete(tk.ALL)
          if self.rectangles == None:
              return
  
          skyline_thickness = 7
          building_thickness = 3
  
          if self.skyline != None:
              # Convert the key points into a polyline.
              points = []
              skyline_len = len(self.skyline)
              points.append((self.skyline[0][0], self.skyline[skyline_len - 1][1]))
              points.append(self.skyline[0])
              for i in range(1, skyline_len):
                  points.append((self.skyline[i][0], self.skyline[i - 1][1]))
                  points.append(self.skyline[i])
  
              # Draw the skyline.
              self.canvas.create_line(points, fill="black", width=skyline_thickness)
  
              # Draw the rectangles.
              for rect in self.rectangles:
                  self.canvas.create_rectangle( \
                      rect.x, rect.y, rect.right(), rect.bottom(),
                      outline="lightgreen", width=building_thickness)
  
          # Draw the ground.
          x1 = self.canvas.winfo_width()
          y1 = self.canvas.winfo_height()
          self.canvas.create_rectangle( \
              0, self.ground_y, x1, y1, fill="sandybrown")
code_tokens: def draw ( self ) : self . canvas . delete ( tk . ALL ) if self . rectangles == None : return skyline_thickness = 7 building_thickness = 3 if self . skyline != None : points = [ ] skyline_len = len ( self . skyline ) points . append ( ( self . skyline [ 0 ] [ 0 ] , self . skyline [ skyline_len - 1 ] [ 1 ] ) ) points . append ( self . skyline [ 0 ] ) for i in range ( 1 , skyline_len ) : points . append ( ( self . skyline [ i ] [ 0 ] , self . skyline [ i - 1 ] [ 1 ] ) ) points . append ( self . skyline [ i ] ) self . canvas . create_line ( points , fill = "black" , width = skyline_thickness ) for rect in self . rectangles : self . canvas . create_rectangle ( rect . x , rect . y , rect . right ( ) , rect . bottom ( ) , outline = "lightgreen" , width = building_thickness ) x1 = self . canvas . winfo_width ( ) y1 = self . canvas . winfo_height ( ) self . canvas . create_rectangle ( 0 , self . ground_y , x1 , y1 , fill = "sandybrown" )
short_docstring: Draw the rectangles and skyline.
short_docstring_tokens: Draw the rectangles and skyline .
comment: """ Draw the rectangles and skyline."""$SEP$# Convert the key points into a polyline.
  $SEP$# Draw the skyline.
  $SEP$# Draw the rectangles.
  $SEP$# Draw the ground.
  