I am a complete beginner and i'm trying to do this:
pygame.init()
fps=60
FramePerSec=pygame.time.Clock()
WHITE=(255,255,255)
font = pygame.font.SysFont('comicsansms',20)
DISPLAYSURF=pygame.display.set_mode((640,480),pygame.RESIZABLE)
pygame.display.set_caption("3")
QUIT=pygame.QUIT
TIME=0
def adjustfontsize():
font=pygame.font.SysFont('comicsansms',int (min(DISPLAYSURF.get_width()/32,DISPLAYSURF.get_height()/24)))
nl=pygame.font.Font.get_linesize(font)*3/4
def writetext(x,y,n,z):DISPLAYSURF.blit(font.render(z,True,WHITE),(x,y+nl*(n-1)))
while True:
DISPLAYSURF.fill((0,0,0))
adjustfontsize()
for event in pygame.event.get():
if event.type==QUIT:
pygame.quit()
sys.exit()
TIME=pygame.time.get_ticks()
if TIME>=2000:
writetext(DISPLAYSURF.get_width()/3,DISPLAYSURF.get_height()/4,1,"¡Hola! Soy la primer línea")
if TIME>=4000:
writetext(DISPLAYSURF.get_width()/3,DISPLAYSURF.get_height()/4,2,"¡Hola! Yo soy la segunda línea")
pygame.display.update()
FramePerSec.tick(fps)
Now, what I would like to know is why the font size still doesn't change. Already added the missing bg draw pointed by Lost Coder, but that was not the issue here. I know there are other ways to do this detailed out there, just want to learn by getting to know what i did wrong. There are not similar functions involved in suggested questions. Thank you very much!