Of course it is possible. Pygame is quite low level: having an object appear and disappear means that you have to draw it on the screen, delete in from the screen, redraw, delete, and so on.
Actually pygame has no function to "delete". To delete, you have to draw something else on top of the shape: the pixels change color to represent the new shape, and the previous is "deleted." So to delete, you usually draw a rectange colored with the background color.
In your case, a flickering rectangle can be achieved by drawing rectangles in alternate colors at the same position each iteration. The following example shows you how to do it:
import sys
import pygame
#some definitions
YELLOW = (255, 255, 0)
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
#initial set up
pygame.init()
screen = pygame.display.set_mode((600, 600))
#making the screen white
screen.fill(WHITE)
#drawing a circle
pygame.draw.circle(screen, YELLOW, (120, 120), 100)
counter = 0
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
#select color for rectange, each iteration alternate color to make flickering
if counter % 2 == 0:
fl_color = YELLOW
else:
fl_color = BLACK
#drawing the rectangle
pygame.draw.rect(screen, fl_color, (10, 300, 400, 250))
pygame.display.flip()
counter += 1
pygame.time.wait(1000) #in milliseconds
As you can see, the circle remains yellow, since we never draw something new on top of it. The rectangle is flickering at 1 second rate.