Skip to main content
Bumped by Community user
edited tags
Link
congusbongus
  • 14.9k
  • 59
  • 91
Source Link
noob96
  • 27
  • 1
  • 2
  • 9

User input text in pygame

I want a text box to appear on the screen. I am doing this by:

TextButton= pygame.draw.rect(Screen,Red, (100, 100, 150,50),2)

How can I allow the user to enter a text into this text box in Pygame? The text box should say 'Enter your name here'. When the user clicks on it, they should be able to enter their name, and submit it if the textbox is not empty. How can I do this in pygame?