【发布时间】:2015-04-26 04:38:47
【问题描述】:
试图让一个盒子在鼠标经过时改变颜色。我遇到的问题是鼠标坐标没有更新。所以程序不知道鼠标在特定位置上。如何让它保持更新鼠标坐标?
def start_screen():
game_display.blit(selection_screen,(0,0))
#buttons
mouse = pygame.mouse.get_pos()
print(mouse)
if 200 + 100 > mouse[0] > 200 and 550 + 50 > mouse[1] > 550:
pygame.draw.rect(game_display,black,(200,550,100,50))
else:
pygame.draw.rect(game_display,white,(200,550,100,50))
pygame.draw.rect(game_display,white,(700,550,100,50))
pygame.display.update()
start_screen()
【问题讨论】:
标签: pygame coordinates python-idle