for this really simple program, it took the images from the file that the script was in. this was a few days ago. now it takes the files from my c_drive.
I fixed this by using the os module and changing the string, but this looks really inefficient.
import os
import pygame
file = os.path.realpath(__file__)
print(file)
path = file.replace('code.py', '')
os.chdir(path)
pygame.init()
screen = pygame.display.set_mode((500, 500))
pygame.display.set_caption('code')
icon = pygame.image.load('idle1.png').convert()
pygame.display.set_icon(icon)
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.display.update()
is there a more effecient way to do this? is my python broken?