[Tutor] Why Won't My Pizza Fall?

earlylight publishing earlylightpublishing at yahoo.com
Sat Jan 12 22:44:32 CET 2008

Hey There Everyone,
  I'm following an example in a book and I can't find the error that's preventing this program from running.  It's just an example of how to get a sprite moving.  The images are all in the right folder.  I can run the program and get a stationary sprite to appear.  The trouble seems to come up when I add "dx" and "dy"  Here's the code.
  from livewires import games
  class Pizza(games.Sprite):
    """A falling pizza."""
    def __init__(self, screen, x, y, image, dx, dy):
        """Initialize pizza object."""
        self.init_sprite(screen = screen, x = x, y = y, image = image,
                             dx = dx, dy = dy)
my_screen = games.Screen(SCREEN_WIDTH, SCREEN_HEIGHT)
  wall_image = games.load_image("skywall.png", transparent = False)
  pizza_image = games.load_image("pizza.png")
Pizza(screen = my_screen, x = SCREEN_WIDTH/2, y = SCREEN_HEIGHT/2,
          image = pizza_image, dx = 0, dy = 1)
  Here's the error message:
  Traceback (most recent call last):
  File "C:/Python25/Chapter 11/movingsprite.py", line 25, in <module>
    image = pizza_image, dx = 0, dy =1)
  File "C:/Python25/Chapter 11/movingsprite.py", line 15, in __init__
    dx = dx, dy = dy)
TypeError: init_sprite() got an unexpected keyword argument 'dx'
  Thanks in advance for any help you can give me.  :-)

Never miss a thing.   Make Yahoo your homepage.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080112/2a2bbdda/attachment.htm 

More information about the Tutor mailing list