but then I got an error telling me that my argument needed to be pygame.Surface not none.
However, when I changed the code to pygame.Surface.blit, it gives me this error code:
TypeError: descriptor 'blit' requires a 'pygame.Surface' object but received a 'NoneType'
What do I do?
Answer
As explained in the commemts - y9u have to load your image in one line of code, and in another line call the set_colorkey method on the image read. And them, blit should be called as a method from an existing surface - not from the Surface class. (With the code as it is now in the question, how would the program "know" where to blit the image to?
So, assuming your screen is on the windowSurface variable you describe, this should work:
Closed. This question needs details or clarity. It is not currently accepting answers.Want to improve this question? Add details and clarify the problem by editing this post.Closed 5 years ago.Improve…
Im using Pandas with latest sqlalchemy (1.4.36) to query a MS SQL DB, using the following Python 3.10.3 [Win] snippet:
import pandas as pd #
from sqlalchemy…
Im working with an XML file that stores all "versions" of the chatbot we create. Currently we have 18 versions and I only care about the most recent one. Im trying to find a way to extract a…
I am having python files with the import statements which I would like to replace into the actual code placed in the foo.py.For instance, with the in file:from foo import Barbar = Bar()
print barI woul…
According to numba 0.51.2 documentation, CUDA Python supports several math functions. However, it doesnt work in the following kernel function:
@cuda.jit
def find_angle(angles):i, j = cuda.grid(2)if i …
I have a list of tuples:list_of_tuples = [(4, 35.26), (1, 48.19), (5, 90.0), (3, 90.0)]tuple[0] is an item_IDtuple[1] is an angleI have a list of item_IDs I want to remove/ignore from the list:ignore_I…
I am trying to implement an "i not equal to j" (i<j) loop, which skips cases where i = j, but I would further like to make the additional requirement that the loop does not repeat the perm…
I have the string "open this and close that" and I want to obtain "open this and" and "close that". This is my best attempt:>>>print( re.split(r[ ](?=(open|clos…
This question already has answers here:Python-get string between to characters(4 answers)Closed 7 years ago.I need a Python regex to give me all the strings between ~ and ^ from a string like this:~~~~…
i am performing a hive query and storing the output in a tsv file in the local FS. I am running a for loop for the hive query and passing different parameters. If the hive query returns no output once …