0
how to add a image to python? but give me a code with location please!!
def Bursa__init__(Bursa): while True: Bursa = pygame.image.load(r"Bursa.png")# your image here! Bursa = pygame.transform.scale(Bursa, (30,30))
1 Resposta
+ 2
To add an image to a Python program using Pygame, you can use the pygame.image.load() function. This function takes a string argument representing the file path of the image you want to load. For example:
import pygame
def Bursa__init__(Bursa):
while True:
Bursa = pygame.image.load(r"C:\Users\User\Desktop\Bursa.png") # your image here!
Bursa = pygame.transform.scale(Bursa, (30,30))
Note that in this example, the image file is located on the user's desktop. You will need to specify the correct file path for the image you want to load.
Also note that this code assumes that you have already imported Pygame and initialized it using pygame.init().