I just want to know the syntax. How do I load an image using pygame.image.load() ? Let's take an example, I want to load an image called cat.png - and type this
pygame.image.load('cat.png')
Then, where should the image cat.png be saved?
I just want to know the syntax. How do I load an image using pygame.image.load() ? Let's take an example, I want to load an image called cat.png - and type this
pygame.image.load('cat.png')
Then, where should the image cat.png be saved?
By default, Python only searches in your current directory for files, however, if you wish to load images from a separate directory, you may find this useful: Importing images from a directory (Python)
For the syntax, I reccomend you refer to the documentation, here: https://www.pygame.org/docs/ref/image.html#pygame.image.load
pygame.image.load()ΒΆ
load new image from a file
load(filename) -> Surface
load(fileobj, namehint="") -> Surface
Load an image from a file source. You can pass either a filename or a Python file-like object.
Any images loaded directly with
pygame.image.load('Image Name')
should be saved in the same folder as the python script that is using the image