Answers
Exercise A:
..
green = pygame.Color(0, 255, 0)
mouse_down = False
last_mouse_pos = (0, 0)
button = (0, 0, 100, 30)
while not done:
pygame.draw.rect(screen, green, button)
for event in pygame.event.get():
..
elif event.type == MOUSEMOTION:
mpos = pygame.mouse.get_pos()
if button[0] < mpos[0] <
(button[0] + button[2]) and \
button[1] < mpos[1] < (button[1] + button[3]):
print("Mouse Over")
pygame.display.update()
pygame.quit()
Exercise B...