1

Here is the code:

class Display:
    def ___init___(self,width,height):
        self.screenWidth = width
        self.screenHeight = height
        #self.background1 = pygame.image.load("background1.png")
        #self.backplace = self.background1.get_rect()
        # Initialize screen

        self.size = self.width, self.height = self.screenWidth, self.screenHeight
        self.screen = pygame.display.set_mode(self.size)
        # Loaded only once to save time
        #self.healthImage = pygame.image.load("healthbetter.png").convert_alpha()
        self.somethingChanged = False   # Nothing changed, no need to draw screen
        self.scrollOffset = 0
        mathclass = Mathclass(self.screen)

This is the error:

"Traceback (most recent call last):
  File "C:\Documents and Settings\Noam\My Documents\games by me\first project\first project.py", line 302, in <module>
    display = Display(640,480)
TypeError: object.__new__() takes no parameters"

I cannot find anything that helps me with this specific error. Can somebody help?

Blckknght
  • 100,903
  • 11
  • 120
  • 169
user2999815
  • 101
  • 3

1 Answers1

4

You have put a extra set of underscores when only two are required for magic methods, instead try this:

def __init__(self,width,height):
K DawG
  • 13,287
  • 9
  • 35
  • 66