Default text on input

In modern browsers, you may set the placeholder attribute on a field to set its default text. However, in older browsers, you may use JavaScript to capture the focus and blur events: Demo: http://jsbin.com/utecu

How can I create a text input box with Pygame?

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 active you can type something and Pygame will generate pygame.KEYDOWN events which have a unicode attribute that you can simply add to a string, … Read more