import pygame.display # get screen resolution pygame.display.init() _info = pygame.display.Info() _w, _h = screen_size = _info.current_w, _info.current_h pygame.display.quit() def pixel_coords(x, y): """ Translate coordinates (x, y) with 0 <= x <= 1 and 0 <= y <= 1 to pixel coordinates using the screen size. """ return _w * x, _h * y