Question about pygame

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


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:, (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]所创,转载请带上原文链接,感谢。