0

Right now I have this code:

cookie = pg.image.load("cookie.png")

screen.blit(cookie, (mid) #mid = WIDTH/2,HEIGHT/2


#---mainloop---#

running = True

while running:

    pg.display.flip()

  

    for event in pg.event.get():

        if event.type == QUIT:

            running = False

        a = pg.mouse.get_focused(cookie)

        if a:

            print(a)

This doesn't print so is there any way to get around this?

I have only a couple of weeks experience with Pygame, so sorry if this was an obvious answer.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Fiftyy
  • 1
  • 2
  • [`pygame.mouse.get_focused()`](https://www.pygame.org/docs/ref/mouse.html#pygame.mouse.get_focused) returns true when pygame is receiving mouse input events (or, in windowing terminology, is "active" or has the "focus"). This function has no parameters. If you want to detect if the mouse cursor is on the image see [Pygame mouse clicking detection](https://stackoverflow.com/questions/10990137/pygame-mouse-clicking-detection) – Rabbid76 Jan 21 '23 at 20:52

0 Answers0