I found certain code in a pygame program, this to be exact:
caplock = False
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.CAPSLOCK:
capslock = True
if event.type == pygame.KEYUP:
if event.key == pygame.CAPSLOCK:
capslock = False
when you press "caps lock" while it is off, capslock
is
True
and when you press "caps lock" while it is on, capslock
is
False
Instead of making capslock
equal to False
at the beginning, how can I make it equal to True
if capslock is already on or False
if it is already off?