Skip to content Skip to sidebar Skip to footer

Pygame 'left' Is Not Defined

I'm working on a game. I have pygame imported. I am using Python 3.3 and Pygame 3.3. The same error message all the time 'LEFT' is not defined. I did exact copies of what were on

Solution 1:

Define LEFT yourself:

LEFT = 1

The Pygame tutorial I think you are following does exactly that. In other words, the pygame library has no constants for this value, it's just an integer.

Solution 2:

As Martijn Pieterspointed out, the pygame library has no constants for the possible values of event.button.

Here's a complete list of the possible values (as a class, so it won't clutter your global namespace):

classMouseButtons:
    LEFT = 1
    MIDDLE = 2
    RIGHT = 3
    WHEEL_UP = 4
    WHEEL_DOWN = 5

Post a Comment for "Pygame 'left' Is Not Defined"