title: AttributeError: 'NoneType' object has no attribute 'push'
body: <p>I was watching a lecture on YouTube and making Tetris.</p>
  <p>But I got this error.</p>
  <pre><code>Traceback (most recent call last):
  File &quot;C:\Users\gkakc\PycharmProjects\Tetris\main.py&quot;, line 90, in &lt;module&gt;
  draw_grid(pen, grid)
  File &quot;C:\Users\gkakc\PycharmProjects\Tetris\main.py&quot;, line 80, in draw_grid
  pen.stamp()
  File &quot;C:\Users\gkakc\AppData\Local\Programs\Python\Python39\lib\turtle.py&quot;, line 3077, in stamp
  self.undobuffer.push((&quot;stamp&quot;, stitem))
  AttributeError: 'NoneType' object has no attribute 'push'
  
  Process finished with exit code 1
  </code></pre>
  <p>That's the code</p>
  <pre><code>import turtle
  import time
  
  # wn = Window
  wn = turtle.Screen()
  wn.title(&quot;Tetris by LeeSooHyung&quot;)
  wn.bgcolor(&quot;black&quot;)
  wn.setup(width=600, height=800)
  wn.tracer(0)
  
  delay = 0.05
  
  class Shape():
      def __init__(self):
          self.x = 5
          self.y = 0
          self.color = 4
  
      def move_left(self, grid):
          if self.x &gt; 0:
              grid[self.y][self.x] = 0
              self.x -= 1
      def move_right(self, grid):
          if self.x &lt; 11:
              grid[self.y][self.x] = 0
              self.x += 1
  
  grid = [
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
      [0, 1, 2, 3, 4, 0, 0, 7, 1, 2, 3, 4]
  
  ]
  pen = turtle.Turtle()
  pen.penup()
  pen.speed(0)
  pen.shape(&quot;square&quot;)
  pen.setundobuffer(None)
  
  def draw_grid(pen, grid):
      top = 230
      left = -110
  
      colors = [&quot;black&quot;, &quot;lightblue&quot;, &quot;blue&quot;, &quot;orange&quot;, &quot;yellow&quot;, &quot;green&quot;, &quot;purple&quot;, &quot;red&quot;]
  
      for y in range(len(grid)):
          for x in range(len(grid[0])):
              screen_x = left + (x * 20)
              screen_y = top - (y * 20)
              color_number = grid[y][x]
              color = colors[color_number]
              pen.color(color)
              pen.goto(screen_x, screen_y)
              pen.stamp()
  
  
  # Create the basic shape for the start of the game
  shape = Shape()
  
  # Put the shape in the grid
  grid[shape.y][shape.x] = shape.color
  
  # Draw the intial grid
  draw_grid(pen, grid)
  
  wn.listen()
  wn.onkeypress(shape.move_left(grid), &quot;a&quot;)
  wn.onkeypress(shape.move_right(grid), &quot;d&quot;)
  
  # Main game loop
  while True:
      wn.update()
  
      # Shape move down
      # Open row
      if shape.y == 23: # if shape is in the bottom row
          shape = Shape()
  
      elif grid[shape.y + 1][shape.x] == 0: # if Nothing there
          grid[shape.y][shape.x] = 0 # Delete the shape of the previous position
          shape.y += 1
          grid[shape.y][shape.x] = shape.color
      else:
          shape = Shape()
  
      draw_grid(pen, grid)
      time.sleep(delay)
  
  # We have to keep the window open, so I loop it.
  wn.mainloop()
  </code></pre>
  <p>I've implemented a block drop.</p>
  <p>But it doesn't work after that.</p>
  <p>I need your help.</p>
  <p>I hope you understood my poor English.</p>