Найти - Пользователи
Полная версия: проблема с pygame
Начало » Python для новичков » проблема с pygame
1
asdfr
Собственно вот такой код
 import pygame
window = pygame.display.set_mode((400, 400))
pygame.display.set_caption('Hello, pygame!')
screen = pygame.Surface((400, 400))
class Sprite:
    def __init__(self,xpos,ypos,filename):
        self.x=xpos
        self.y=ypos
        self.bitmap=pygame.image.load(filename)
        self.bitmap.set_colorkey((0,0,0))
    def render(self):
        screen.blit(self.bitmap,(self.x,self.y))
hero = Sprite(0, 0, 'images/h.png')
zet = Sprite(0, 0, 'images/z.png')
done = True
while done:
    for e in pygame.event.get():
        if e.type == pygame.QUIT:
            done = False
    screen.fill((50,50,50))
    hero.render()
    zet.reder()
    window.blit(screen, (0,0))
    pygame.display.flip()
    pygame.time.delay(5)
Запускаю на питон 2.7
ошибка
Traceback (most recent call last):
File “C:\Users\1\Desktop\питон дз3\44.py”, line 16, in <module>
hero = Sprite(0, 0, ‘images/h.png’)
File “C:\Users\1\Desktop\питон дз3\44.py”, line 11, in __init__
self.bitmap=pygame.image.load(filename)
error: Couldn't open images/h.png

Путь к файлам как уже только не прописывал.вообще они лежат в одной папке с программой. по сути путь и не нужен.
подскажите в чем тут проблема?
FishHook
asdfr
C:\Users\1\Desktop\питон дз3\44.py
Уберите все русские буквы из пути
asdfr
FishHook
убрал
не помогает
Traceback (most recent call last):
File “C:\Users\1\Desktop\python3\44.py”, line 16, in <module>
hero = Sprite(0, 0, ‘C:\Users\1\Desktop\python3\h.png’)
File “C:\Users\1\Desktop\python3\44.py”, line 11, in __init__
self.bitmap=pygame.image.load(filename)
error: Couldn't open C:\Users\Desktop\python3\h.png
FishHook
asdfr
Couldn't open C:\Users\Desktop\python3\h.png
asdfr
“C:\Users\1\Desktop\python3\44.py”

Ну это же разные пути. В одном единичка,в другом нету.
asdfr
FishHook
все спасибо разобрался. файлы были дешифрованы.программой kerish doktor. и их просто нужно было разблокировать
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB