请问,如果background图片出来是全黑的是什么原因
pygame吧
全部回复
仅看楼主
level 1
静踩cO 楼主
第一个程序就瞎了[泪]
background_image_filename='C:\Users\gyzhang\Desktop\\forfun\\batcar.jpg'
mouse_image_filename='C:\Users\gyzhang\Desktop\\forfun\\circle.jpg'
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
screen=pygame.display.set_mode((800,518),0,32)
pygame.display.set_caption('hello world!')
background=pygame.image.load(background_image_filenam
e).convert()
mouse_cursor=pygame.image.load(mouse_image_filename).convert()
while True:
for event in pygame.event.get():
if event.type==quit:
exit()
screen.blit(background,(0,0))
x,y=pygame.mouse.get_pos()
x-=mouse_cursor.get_width()/2
y-=mouse_cursor.get_height()/2
screen.blit(mouse_cursor,(x,y))
pygame.display.update()
2016年04月12日 04点04分 1
level 1
静踩cO 楼主
自己解决了是缩进问题:
background_image_filename='C:\Users\gyzhang\Desktop\\forfun\\batcar.png'
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
screen=pygame.display.set_mode((800,518),0,32)
pygame.display.set_caption('hello world!')
background=pygame.image.load(background_image_filename).convert()
while True:
for event in pygame.event.get():
if event.type==quit:
exit()
screen.blit(background,(0,0))
pygame.display.update()
2016年04月12日 05点04分 2
level 4
楼主,还在么,你知道图片找不到是怎么回事么
2016年08月14日 17点08分 3
我可以帮忙看看哦
2016年08月23日 18点08分
我也可以帮忙看看,一般是你的图片没有放在指定的路径上
2017年12月27日 03点12分
1