Showing your code might help... But basically, I can guess you are trying to store a float in a String variable. In the pointed out example, the numbers are converted by concatenating them with a string. You can also use the str() function.
Well, firstly, your suggestion has given me more know-how, so thank you.
Perhaps some background information is useful. I am working towards creating an experiment, where users input information about what they see on the screen. They do this iteratively. So they see something, input data, go to the next screen, see something, input data, and so on. For that reason, having all the pictures drawn at once is not helpful (here). (I will eventually need to learn how to gather user data - but one thing at a time)
So, I would ideally like to be set on the right way for this. Which is why I asked about the key pressed event.