在我的背景图像上移动时如何阻止我的矩形留下痕迹

How to stop my rect from leaving a trail when moving over my background image

I am making a pong game and the ball object leaves a trail when it moves and I was wondering how to stop it from doing this any help would be greatly appreciated. Thank you in advance. Here is my code:

import sys
import pygame
pygame.init()
clock = pygame.time.Clock()
# screen setup
screen_width = 1200
screen_height = 700
screen = pygame.display.set_mode((screen_width, screen_height))
background = pygame.image.load("spacebackground.png").convert_alpha()
pygame.mouse.set_visible(False)
pygame.display.set_caption('pong')


# set up player and opponent and ball rect
player = pygame.Rect(screen_width - 20,screen_height/2 - 70,10,140)
opponent = pygame.Rect(10,screen_height/2 - 70,10,140 )
ball = pygame.Rect(screen_width/2-15, screen_height/2 - 15,30, 30)

ball_speed_x = 7
ball_speed_y = 7
# defining clock and colour
red = (0,0,0)

clock = pygame.time.Clock()

while True:

    pygame.display.update(ball)
    pygame.display.flip()
    screen.blit(background, (0, 0))
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

    ball.x += ball_speed_x
    ball.y += ball_speed_y
    # Drawing the rects
    pygame.draw.rect(background, red, player)
    pygame.draw.rect(background, red, opponent)
    pygame.draw.ellipse(background, red, ball)
    pygame.display.update(ball)

    clock.tick(60)


    

screen 而不是 background 上绘制对象:

run = True
while run:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False 

    ball.x += ball_speed_x
    ball.y += ball_speed_y
   
    # draw background on the screen
    screen.blit(background, (0, 0))

    # draw objects on the screen
    pygame.draw.rect(screen, red, player)
    pygame.draw.rect(screen, red, opponent)
    pygame.draw.ellipse(screen, red, ball)
    
    # update the display
    pygame.display.flip()

    clock.tick(60)

pygame.quit()
sys.exit()