I know that the title is a bit vague. So I’ll give an example:
keypressed('e')
should return true or false, at the moment I do it like this
def ispressed(key):
x = False
ldict = {}
exec(f"x = pygame.key.get_pressed()[pygame.K_{key.lower()}]",{'x':x,'pygame':pygame},ldict)
return ldict['x']
which I have found to be very inefficient.
Is there any other way to do this, thanks.
P.S It’ll be about a while till I can respond.