tell me the way to change pygame function from string to function in python?

Try using exec command. for example if you have a string temp_string = “print(‘hello world’)” and you want to execute this string as a command in python then you should use exec() function as

exec(temp_string)

so in your case it should be exec(“pygame.Rect(50, 50, 100, 100)”)

I think it should work.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top