Psychopy library is a useful framework to develop psychological experiments using Python. If you are interested on learning how to use it, I made this tutorial where I show how to develop a basic experiment that registers how much time it takes for someone to press a key. The full code can be found here.