I’m not sure why, but after some experimentation I have discovered that the surface created with font.render
cannot have it’s alpha value changed. Just blit that surface to another surface, and change the alpha value of the new surface.
textsurface=font.render('Test', True, (0, 0, 0))
surface=pygame.Surface((100, 30))
surface.fill((255, 255, 255))
surface.blit(textsurface, pygame.Rect(0, 0, 10, 10))
surface.set_alpha(50)
window.blit(surface, pygame.Rect(0, 30, 10, 10))