Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

destory image in pygame

You can fill individual images, since they are pygame Surfaces.

First, what I would do is I would put something like this after defining the leaf's x/y:

leaf.image = img1

Then, I would create a color variable called transparent:

transparent = (0, 0, 0, 0)

The first 3 numbers, as you might know, represent RGB color values. The last number is the alpha (transparency) value of a color. 0 is completely invisible.

Finally, I would add this code to make the leaf completely transparent:

leaf.image.fill(transparent)

This makes the leaf transparent without making every other image in your window disappear. Hope this helped!
Comment

PREVIOUS NEXT
Code Example
Python :: Python Program to Sort Words in Alphabetic Order 
Python :: how to remove text from plot in python 
Python :: Default stride value in keras 
Python :: Iterating With for Loops in Python 
Python :: how to add values in python 
Python :: python inline if 
Python :: normalize a group in countplot 
Python :: amazon redshift 
Python :: dictionary input from user in python3 
Python :: how to for loop in python stackoverflow 
Python :: how to print text in python 
Python :: keep the user logged in even though user changes password django 
Python :: dataframe.fillna 
Python :: reverse a list in python 
Python :: python match case 
Python :: set default palette seaborn 
Python :: linux python 
Python :: how to code a funtion in python 
Python :: django login required as admin 
Python :: add legend to colorbar 
Python :: python regex (d)(?=d1) 
Python :: lower method in python 
Python :: Function to plot as many bars as you wish 
Python :: remove a part of a string python 
Python :: python all() function 
Python :: when to use finally python 
Python :: convert time python 
Python :: when iterating through a pandas dataframe using index, is the index +1 able to be compared 
Python :: how to access pandas column 
Python :: else if 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =