External Exam Download Resources Web Applications Games Recycle Bin

Mouse Click

mouse click.py

import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False
while not done:
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      done = True

    if event.type == pygame.MOUSEBUTTONDOWN: #single click
      print("mouse clicked")
      
  pygame.display.flip()
pygame.quit()