0

I have some code which produces a sort of grid of letters that I want to scroll across- (that bit's not important I don't think). At the moment the 'scrolling' function works but only if you type in 'r' and then the key.

Is there a way of making it so that as soon as you hit 'r' it's 'entered' and the program responds?

This is a tiny bit of the code.

print('Enter [r] for right and [l] for left:')
            input_val = raw_input('Left or Right: ')

            if input_val == 'r':
                a += 10
                b += 10
  • You can't do this with a console application (ie. using `raw_input`). Find a tutorial on a library like `pygame` or similar. – Selcuk Nov 04 '16 at 11:07
  • Also see http://stackoverflow.com/questions/5044073/python-cross-platform-listening-for-keypresses – PM 2Ring Nov 04 '16 at 11:08

0 Answers0