L
L
leon -----2021-01-28 22:29:49
Python
leon -----, 2021-01-28 22:29:49

Error in Pygame:TypeError: 'str' object is not callable'. What to do?

I wrote the code but it keeps giving me an error.
The code:

import pygame
pygame.init()
size = (250,500)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Змуйка")
img = pygame.image.load("1zmeya.png")
pygame.display.set_icon(img)

font = pygame.font.SysFont('comicsansms'(32))
RED = (255,0,0)
GREEN = (0,255,0)
follow = font.render("Привет мир!",1,RED,GREEN)

while True:
    for event in pygame.event.get():
    	if event.type == pygame.QUIT:
    		quit()
    screen.blit(follow,  (0,0))
    pygame.display.update()

---------------------------------------------------
Error:
Traceback (most recent call last):
File "C:/Users/****/New Folder/1112.py", line 9, in
font = pygame.font.SysFont('comicsansms'(32))
TypeError: 'str' object is not callable
(Thanks in advance!)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alan Gibizov, 2021-01-28
@leon1000

should be something like this:
font = pygame.font.SysFont('comicsansms', 32)

W
Wispik, 2021-01-28
@Wispik

pygame.font.SysFont('comicsansms', 32)
comma

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question