Question about pygame

CSDN Q&A 2022-08-06 19:02:30 阅读数:21

questionpygame

While continuously accepting commands from the console with input, while drawing on the pygame window according to the command, it sounds simple, but there are too many problems
First pygame needs

 while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() pygame.display.update()

On the other hand I need

 while True: com = input('>') if 'add' in com: pygame.draw.circle(screen, (0, 0, 0), ( 250, 250), 3)

Adding the input directly to the while True loop outside pygame.display.update() will cause the pygame page to freeze, the multi-thread attempt fails, and the multi-process fails: EOF when reading a line

Would you like to write a picture for me?

版权声明:本文为[CSDN Q&A]所创,转载请带上原文链接,感谢。 https://primo.wiki/2022/218/202207310344169210.html