-1

I'm creating a simple game to try to learn pygame, and I currently have a game where the user controls a car and has to dodge trucks on a highway.

The game starts off pretty slowly, but I want to add an input box for the user to set their own starting speed.

I know how to make working buttons, but I would rather have a text input that saves to a variable as an integer.

Can anyone help with this?

2
  • I tried some script I found on the internet, but it didn't work Commented Jan 25, 2018 at 11:55
  • Krystian, please read How do I ask a good question? and How to create a Minimal, Complete, and Verifiable example Post the code you tried, describe, why it didn't do, what you expected and post the full traceback of error messages. Editing questions is encouraged to improve the quality on SO. Commented Jan 25, 2018 at 12:09

1 Answer 1

1

you can use inputbox form pygame.

refer link

Then use:

inputbox.ask(screen, "question")

This will return string which can be casted to int

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.