telmo96 0 Newbie Poster

I'm trying to compile the following pygame code:

import sys, pygame
pygame.init()

size = width, height = 320, 240
speed = [2, 2]
black = 0, 0, 0

screen = pygame.display.set_mode(size)

ball = pygame.image.load("ball.gif")
ballrect = ball.get_rect()

while 1:
    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()

    ballrect = ballrect.move(speed)
    if ballrect.left < 0 or ballrect.right > width:
        speed[0] = -speed[0]
    if ballrect.top < 0 or ballrect.bottom > height:
        speed[1] = -speed[1]

    screen.fill(black)
    screen.blit(ball, ballrect)
    pygame.display.flip()

Using the following setup.py file:

from cx_Freeze import setup, Executable

includes = ["pygame"] 
exe = Executable(
    script="ball.pyw",
    base="Win32GUI"
    )
 
setup(
    options = {"build_exe": {"includes":includes}},
    executables = [exe]
    )

And I'm getting the following error when trying to execute the ball.exe:

[img]http://i43.tinypic.com/102qgqh.jpg[/img]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.