Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Python Run error

LinuxProgManLinuxProgMan Posts: 2Member
Hello I am new here and I just started working in python a month ago. I am working on a simple program to get a little red ball to follow my mouse around. I can find the error and I don't know what the error message it gives me means. Here is the code: [code]bif="pygame.jpg"
mif="ball.png"

import pygame ,sys
from pygame.locals import *
pygame.init()
screen=pygame.display.set_mode((640,360),0,32)

background=pygame.image.load(pygame).convert()
mouse_c=pygame.image.load(ball).convert_alpha()

while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
screen.blit(background, (0.0))

x,y = pygame.mouse.get_pos()
x -= mouse_c.get_width()/2
y -= mouse_c.get_height()/2

screen.blit(mouse_c,(x,y))

pygame.display.update()[/code]
And here is the error I get[code]Traceback (most recent call last):
File "C:UsersAwesomePilotDocumentsProgrammingPythonPygame1gameSRC.py", line 9, in
background=pygame.image.load(pygame).convert()
error: Can't seek in this data source[/code]

If I hit run it acts like its gonna run for a second, then it freezes as a black window and the it doesn't respond. Please help Thank You :)
Sign In or Register to comment.