I'm trying to add an event listener for the right click so it does something while the right click is pressed. I tried all solutions on google but everyone gives me an error. I ended up with
if pygame.event.type == pygame.MOUSEBUTTONUP:
print 'check1'
if pygame.event.button == RIGHT:
print "check2"
Nothing is printed, error:
if pygame.event.type == pygame.MOUSEBUTTONUP:
AttributeError: 'module' object has no attribute 'type'
Suggested:
for event in pygame.event.get():
if event.type==pygame.MOUSEBUTTONDOWN: #other event types are pygame.QUIT,
pygame.MOUSEBUTTONUP, ...
print("check1")
if event.button==3: #1 is left, 2 is mouse wheel, and 3 is right
print("check2")
Does not work, it doesn't print anything nor execute code.