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 the internet as I already did a search for the problem.
Here is my code. I have tried a few different ways and neither seem to work.
method 1:
import pygame
event = pygame.event.poll()
if event.type == pygame.MOUSEBUTTONDOWN and event.button == LEFT:
....command
method 2: (basically going all in)
from pygame import *
from pygame.locals import *
import pygame
event = pygame.event.poll()
if event.type == MOUSEBUTTONDOWN and event.button == LEFT:
......command
Before telling me, on both those methods I tried switching between “LEFT” and “pygame.LEFT”, and so on.
Any ideas?
Hugely appreciated.
Define
LEFTyourself:The Pygame tutorial I think you are following does exactly that. In other words, the
pygamelibrary has no constants for this value, it’s just an integer.