title: Why is this Simple 2d movement lagging so much?
body: <p>I am trying to make snake and just tried to add movement to my snake.</p>
  <p>Unfortunately this code causes the snake to stop then speed up and makes it unusable.
  What I would like to see is the snake moving at a constant speed across the screen without it stuttering and jumping forward.</p>
  <pre><code>import pygame
  import random
  
  DIM = (800, 800)
  WIN = pygame.display.set_mode(DIM)
  CLOCK = pygame.time.Clock()
  SIZE = 20
  GRID = [DIM[0] / SIZE, DIM[1] / SIZE]
  
  
  
  
  
  class snake:
      def __init__(self):
          self.color = (0, 255, 0)
          self.x = 1
          self.y = 1
          self.direct = 0
  
      def draw(self, win=WIN):
          pygame.draw.rect(win, self.color, (self.x * SIZE, self.y * SIZE, SIZE, SIZE))
  
      def move(self, direct):
          self.direct = direct
          print(self.direct)
          if self.direct == 1:
              self.x = self.x - 1
          if self.direct == 2:
              self.x = self.x + 1
          if self.direct == 3:
              self.y = self.y - 1
          if self.direct == 4:
              self.y = self.x + 1
  
  
  def main(win=WIN):
      direction = 0
  
      running = True
      
      snak = snake()
      while running:
          win.fill((120, 120, 120))
          for event in pygame.event.get():
              if event.type == pygame.QUIT:
                  running = False
              keys = pygame.key.get_pressed()
              if keys[pygame.K_a]:
                  direction = 1
              elif keys[pygame.K_d]:
                  direction = 2
              elif keys[pygame.K_w]:
                  direction = 3
              elif keys[pygame.K_s]:
                  direction = 4
              snak.move(direction)
  
          snak.draw()
          #CLOCK.tick(10)
          pygame.display.flip()
  
  
  main()
  </code></pre>
  <p>I also tried running it on another computer to see if maybe it was a hardware problem but I came up with the same result.
  Thank you for helping.</p>