试图将两张图片并排放置在pygame的界面中,但出现错误
TypeError:blit的目标位置无效
import pygame
from pygame.locals import *
import urllib.request
from urllib.request import urlopen
pygame.init() #initialize pygame
image1_url = "http://polygonblog.com.www32.zoner-asiakas.fi/wp-content/uploads/2010/05/underwater.jpg"
image1_str = urllib.request.urlretrieve(image1_url, "sea.png")
image2_url = "http://www.seascapemodeling.org/seascape_projects/Slicks.jpg"
image2_str = urllib.request.urlretrieve(image2_url, "surface.png")
white = (255,255,255)
screen = pygame.display.set_mode((600,440))
sea = pygame.image.load('sea.png').convert()
sea_rect = sea.get_rect()
sea_rect.x = 220
sea_rect.y = 600
sea_rect = sea_rect.left
surface = pygame.image.load('surface.png').convert()
surface_rect = surface.get_rect()
surface_rect.x = 220
surface_rect.y = 600
surface_rect = surface_rect.right
screen.fill(white)
while True:
screen.blit(surface, surface_rect)
screen.blit(sea,sea_rect)
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
raise SystemExit