How can I create a text input box with Pygame?
问题 I want to get some text input from the user in Python and display what they are typing in a text box, and when they press enter, it gets stored in a string. I've looked everywhere, but I just can't find anything. I'm using Pygame. 回答1: You can define a rect as the area of the input box. If a pygame.MOUSEBUTTONDOWN event occurs, use the colliderect method of the input_box rect to check if it collides with the event.pos and then activate it by setting a active variable to True . If the box is