This code is from the book "Beginning Game Development with Python and Pygame", the following script displays the events that are generated by the mouse and the keyboard on the screen:
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
SCREEN_SIZE = (800, 600)
screen = pygame.display.set_mode(SCREEN_SIZE, 0, 32)
font = pygame.font.SysFont("arial", 16)
font_height = font.get_linesize()
event_text = []
while True:
event = pygame.event.wait()
event_text.append(str(event))
event_text = event_text[-SCREEN_SIZE[1]/font_height:]
I have a problem with this line:
event_text = event_text[-SCREEN_SIZE[1]/font_height:]
Could someone explain it? Thanks in advance :)