Python 如何使pygame精灵的背景透明
这应该只是加载一个精灵到屏幕上,但图像的背景是这个黑匣子,我不想看到它。如何使图像的背景透明Python 如何使pygame精灵的背景透明,python,pygame,png,Python,Pygame,Png,这应该只是加载一个精灵到屏幕上,但图像的背景是这个黑匣子,我不想看到它。如何使图像的背景透明 from Tkinter import * import pygame from livewires import games #Creating screen window games.init(screen_width = 700, screen_height = 650, fps = 50) #creating background image for the screen screen_ba
from Tkinter import *
import pygame
from livewires import games
#Creating screen window
games.init(screen_width = 700, screen_height = 650, fps = 50)
#creating background image for the screen
screen_background = games.load_image('resized_stars background.png', transparent = False)
games.screen.background = screen_background
#Creating a sprite
spaceship_image = games.load_image('pixel_spaceship.png')
spaceship = games.Sprite(image = spaceship_image, x=350, y=235)
games.screen.add(spaceship)
#main loop at the end of the program just as in tkinter
games.screen.mainloop()
你的形象需要是一个好的形象。例如,打开预览,并使用alpha工具删除背景,从而增加透明度
之前:
之后:
寻找使图片透明的工具。谢谢您的帮助!对不起,如果这是个愚蠢的问题。但是我用AdobePhotoshop去除了背景,当我把图像加载到程序中时,它有一个奇怪的背景,黑色的,五颜六色的透明斑点。那么为什么Photoshop不能工作呢?