0

I would like to create an input box in the main menu in my game to enter a player nickname and I can't find any libraries or other method to do this.

How can I do this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
RageZ
  • 177
  • 1
  • 7

1 Answers1

0

I'm not sure if this is what you mean, but the input() function allows user input.

For example:

print('Enter your nickname: ')
nm = input()
print('Hello, ' + nm)
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alkis Ko
  • 99
  • 1
  • 12
  • :D but it's not console app, I need to make some box for example pygame.Rect(50, 100, 200, 50) but with possibility to type in – RageZ Apr 27 '20 at 19:48
  • You cannot use the `input` function in an GUI application, as it blocks the application. – Ted Klein Bergman Apr 27 '20 at 19:52
  • But for sure there is some way to create some kind of input box – RageZ Apr 27 '20 at 19:55
  • I think you need to use get_text() to get the input of the user. First, create a text input object, and then use the update method to check when the user has given an answer. Something like that – Alkis Ko Apr 27 '20 at 20:04