|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import pygame
import sys
from pygame.locals import *
pygame.init()
size = width,height = 400,601
bg = (0,0,0)
clock = pygame.time.Clock()
screen = pygame.display.set_mode(size)
pygame.display.set_caption("背景")
turtle = pygame.image.load("F:\工程\python\pygame1zhu.jpg").convert()
background = pygame.image.load("F:\工程\python\背景.jpg").convert()
position = turtle.get_rect()
position.center = width // 2,height // 2
while True:
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()
screen.blit(background,(0.0))
screen.blit(turtle,position)
pygame.display.flip()
clock.tick(10)
代码自己没发现问题但是报错
Traceback (most recent call last):
File "F:\工程\python\背景.py", line 28, in <module>
screen.blit(background,(0.0))
TypeError: invalid destination position for blit
是因为图片的问题吗,怎么解决。
screen.blit(background,(0.0))
不是 0.0,是 0,0
|
|