while true loop doesn't work inside another in python -
i have while true
loop (code below) within loop. want check if clicked on button , if so, change cursor image have imported before. tried hiding cursor , let image follow it. when run this, hides cursor draws image was, doesn't move cursor.
while true: event in pygame.event.get(): if event.type == mousebuttonup: mousex, mousey = pygame.mouse.get_pos() if mousex > 100 , mousex < 200 , mousey > 50 , mousey < 100: # button on screen pygame.mouse.set_visible(false) while true: mousex, mousey = pygame.mouse.get_pos() displaysurf.blit(cursorimg, (mousex,mousey)) pygame.display.update()
can tell me doing wrong please?
change code this:
while true: event in pygame.event.get(): if event.type == mousebuttonup: mousex, mousey = pygame.mouse.get_pos() if mousex > 100 , mousex < 200 , mousey > 50 , mousey < 100: # button on screen pygame.mouse.set_visible(false) mousex, mousey = pygame.mouse.get_pos() displaysurf.blit(cursorimg, (mousex,mousey)) pygame.display.update()
Comments
Post a Comment