pygame holding a button down
while running:
keys = key.get_pressed()
if keys[K_DOWN]:
print "DOWN"
for e in event.get():
pass
pygame holding a button down
while running:
keys = key.get_pressed()
if keys[K_DOWN]:
print "DOWN"
for e in event.get():
pass
event.type == pygame.MOUSEBUTTONDOWN click
def handle_event(self, screen, event, player):
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.MOUSEMOTION:
pygame.draw.rect(screen, BACKGROUND, (0,0, self.screen_width, SQUARESIZE))
posx = event.pos[0]
if player == 1:
pygame.draw.circle(screen, P1STONE, (posx, int(SQUARESIZE/2)), RADIUS)
else:
pygame.draw.circle(screen, P2STONE, (posx, int(SQUARESIZE/2)), RADIUS)
pygame.display.update()
return None
if event.type == pygame.MOUSEBUTTONDOWN:
pygame.draw.rect(screen, BACKGROUND, (0,0, self.screen_width, SQUARESIZE))
posx = event.pos[0]
action = int(np.floor(posx/SQUARESIZE))
return action
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us