You can use the pygame.font
module to display text in your window.
Example:
import pygame
import sys
pygame.init()
font = pygame.font.SysFont("monospace", 15)
screen = pygame.display.set_mode((400,100))
cur_x, cur_y = 0,0
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit(0)
elif event.type == pygame.MOUSEMOTION:
cur_x, cur_y = event.pos
screen.fill((0,0,0))
coord_message = "position: x={}, y={}:".format(cur_x, cur_y)
coord_label = font.render(coord_message, 1, (255,0,0))
screen.blit(coord_label, (50, 10))
pygame.display.flip()
Result: