title: Pygame Sprite flickers when moving
body: <p>I am new to pygame and have been having some problems with a sprite flickering/dragging it's image when it moves across the screen. I have read other answers on here about getting a certain pix/s, where you should change the framerate and lower pix/frame, but that solution hasn't helped so I was wondering if I'm just not implementing it correctly and that's the only solution or if I am missing something. Below is some the code for the game that runs at a constant framerate. Thank you!</p>
  
  <pre><code>pygame.init()
  display=pygame.display.set_mode((screen_width,screen_height), pygame.RESIZABLE)
  background=pygame.Surface((screen_width, screen_height))
  background.fill(background_color)
  
  class Ship(pygame.sprite.Sprite):
      def __init__(self, image_file):
          pygame.sprite.Sprite.__init__(self)
          self.original_image_unscaled=pygame.image.load(image_file)
          self.original_image=pygame.transform.smoothscale(self.original_image_unscaled, (56,70))
          self.image=self.original_image
          self.rect=self.image.get_rect()
          self.xpos=0
          self.ypos=0
          self.rect.centerx=self.xpos
          self.rect.centery=self.ypos
          self.vel=0
          self.acc=.05
          self.brake=.2
          self.turn_brake=1.5
          self.angle=0
          self.max_speed=5
  
      def getShipPos(self):
          return (self.xpos, self.ypos)
  
      def getShipVel(self):
          return self.vel
  
      def getShipAcc(self):
          return self.acc
  
      def getShipRect(self):
          return self.rect
  
      def update(self):
          self.rect.centerx=self.xpos
          self.rect.centery=self.ypos
  
      def rotateShip(self, angle):
          #this rotates the ship by a specified angle
          self.image, self.rect = pygameRotateImage2(self.original_image, self.rect, angle-self.angle)
          self.angle+=angle
  
      def simpleMove(self, x_final, y_final):
          self.xpos=x_final
          self.ypos=y_final
  
      def moveShip(self):
          keys=pygame.key.get_pressed()
          xpos_i=self.xpos
          ypos_i=self.ypos
          if keys[K_w]:
              if self.vel&gt;self.max_speed:
                  self.vel=self.max_speed
              else:
                  self.vel+=self.acc          
          elif keys[K_s]:
              self.vel-=self.brake
              if self.vel&lt;0:
                  self.vel=0          
  
          if keys[K_a]:
              self.rotateShip(-self.turn_brake)
          elif keys[K_d]:
              self.rotateShip(self.turn_brake)
  
          self.xpos+=self.vel*math.sin(math.radians(self.angle))
          self.ypos+= -self.vel*math.cos(math.radians(self.angle))
  
  display.blit(background, (0,0))
  pygame.display.update()
  
  player_ship=Ship('image.png')
  player_ship.simpleMove(screen_width/2, screen_height/2)
  
  movement_group=pygame.sprite.Group()
  movement_group.add(player_ship)
  
  clock=pygame.time.Clock()
  while True:
      clock.tick(60)
      (mousex,mousey)=pygame.mouse.get_pos()
      for event in pygame.event.get():
          if event.type==QUIT:
              pygame.quit()
              sys.exit()
      player_ship.moveShip()
  
      movement_group.update()
      display.blit(background, (0,0))
      movement_group.draw(display)
      pygame.display.update()
  </code></pre>