How To Load Image Using Pygame.image.load()?
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('
Solution 1:
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()¶
loadnewimagefromafileload(filename) -> Surfaceload(fileobj, namehint="") -> SurfaceLoadanimagefromafilesource. YoucanpasseitherafilenameoraPythonfile-likeobject.
Post a Comment for "How To Load Image Using Pygame.image.load()?"