Creating an update function within my display class in Python
Question: So I am trying to code it when I call my myDisplay.update() function I can
pass whatever game element I want to update into it, to display the image. For
example I made a player with a player class, and I want to pass it into
myDisplay.update(player), to pull the sprite from the player class and then
render it in the update method.

Current Error:

    
    
    AttributeError: 'Display' object has no attribute 'blit'
    

Current Code:

    
    
    import pygame, sys
    from pygame.locals import *
    
    #Constants
    TILESIZE = 32
    MAPWIDTH = 16
    MAPHEIGHT = 16
    
    #variables
    playing = True
    
    #Creates Display Window
    class Display(object):
    
        def __init__(self, width, height, tilesize):
            pygame.init()
            pygame.display.set_caption("FarmTown Version 1.0")
            self.SCREEN_WIDTH = width * tilesize
            self.SCREEN_HEIGHT = height * tilesize
            self.myScreen = pygame.display.set_mode([self.SCREEN_WIDTH, self.SCREEN_HEIGHT])
    
        def update(self, updated):
            self.blit(updated.image, (playerPos[0] * TILESIZE, playerPos[1] * TILESIZE))
            pygame.display.update()
    
    class Controller(object):
        controls = {
            "KEY_UP": 273,
            "KEY_DOWN": 274,
            "KEY_RIGHT": 275,
            "KEY_LEFT": 276
            }
    
        def checkInput(self):
            for key in self.controls:
                if event.key == self.controls[key]:
                    if self.controls[key] == self.controls["KEY_UP"]:
                        print "Up"
                    elif self.controls[key] == self.controls["KEY_DOWN"]:
                        print "Down"
                    elif self.controls[key] == self.controls["KEY_RIGHT"]:
                        print "Right"
                    elif self.controls[key] == self.controls["KEY_LEFT"]:
                        print "Left"
    
    class Player(object):
        def __init__(self):
            #if playerClass == "peasant":
            self.image = pygame.image.load("player.png")
            self.pos = [0, 0]
    
    #Set Up Everything To Play
    myDisplay = Display(MAPWIDTH, MAPHEIGHT, TILESIZE)
    myController = Controller()
    player = Player()
    
    
    #Game Loop Begins
    while playing:
    
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()
            elif event.type == KEYDOWN:
                myController.checkInput()
    
        myDisplay.update(player)
    


Answer: I think you meant to subclass a pygame object. Currently Display is a subclass
of just "object", which doesn't contain the "blit" method. Or did you mean to
write `pygame.blit` or `pygame.display.blit` instead of `self.blit`?

