How do I bind a key to run a section of code?
So I've been working on a project, and wondering if there was a way that I could bind a key so that whenever you press that key (i.e., 7 or 9) that it would run a certain section of code. Is that possible?
Yeah, it looks like your using getch, so you would need to do something like this:
from getch import getch def myFunction(): #run this code while True: i = getch() if i == '9': myFunction()