This is a reasonably straightforward operation.
First load in the image you want to tile:
tile_image = pygame.image.load( 'my_tile.png' ).convert_alpha()
Then create a new PyGame Surface of the required size:
tiled_image = pygame.Surface( ( width, height ) )
Then using two loops, step down & across the surface, "stamping" a copy of the image. After each stamp, calculate the location of the next placement. Continue stamping across the X-horizontals, and down the Y-vertical until all pixels are covered:
x_cursor = 0
y_cursor = 0
while ( y_cursor < height ):
while ( x_cursor < width ):
tiled_image.blit( tile, ( x_cursor, y_cursor ) )
x_cursor += tile.get_width()
y_cursor += tile.get_height()
x_cursor = 0
Now wrap all that into a handy-to-use function:
def makeTiledImage( image, width, height ):
x_cursor = 0
y_cursor = 0
tiled_image = pygame.Surface( ( width, height ) )
while ( y_cursor < height ):
while ( x_cursor < width ):
tiled_image.blit( image, ( x_cursor, y_cursor ) )
x_cursor += image.get_width()
y_cursor += image.get_height()
x_cursor = 0
return tiled_image
Which can be called:
tile_image = pygame.image.load( 'my_tile.png' ).convert_alpha()
platform = makeTiledImage( tile_image, 250, 30 )

Reference Code:
import pygame
# Window size
WINDOW_WIDTH = 400
WINDOW_HEIGHT = 400
WINDOW_FPS = 60
WINDOW_SURFACE = pygame.HWSURFACE|pygame.DOUBLEBUF|pygame.RESIZABLE
DARK_BLUE = ( 3, 5, 54)
def makeTiledImage( image, width, height ):
""" Given an image, make another image tiled with the given image """
x_cursor = 0
y_cursor = 0
tiled_image = pygame.Surface( ( width, height ) )
while ( y_cursor < height ):
while ( x_cursor < width ):
tiled_image.blit( image, ( x_cursor, y_cursor ) )
x_cursor += image.get_width()
y_cursor += image.get_height()
x_cursor = 0
return tiled_image
### initialisation
pygame.init()
pygame.mixer.init()
window = pygame.display.set_mode( ( WINDOW_WIDTH, WINDOW_HEIGHT ), WINDOW_SURFACE )
pygame.display.set_caption("Tiled Rect")
tile_image = pygame.image.load( 'rot_offcentre_1.png' ).convert_alpha()
platform = makeTiledImage( tile_image, 250, 30 )
### Main Loop
clock = pygame.time.Clock()
done = False
while not done:
# Handle user-input
for event in pygame.event.get():
if ( event.type == pygame.QUIT ):
done = True
elif ( event.type == pygame.MOUSEBUTTONUP ):
# On mouse-click
pass
# Update the window, but not more than 60fps
window.fill( DARK_BLUE )
window.blit( platform, ( 50, 150 ) )
pygame.display.flip()
# Clamp FPS
clock.tick_busy_loop( WINDOW_FPS )
pygame.quit()