Use the rect of each text surface. Then you can get the mouse position with
pygame.mouse.getpos()
http://www.pygame.org/docs/ref/mouse.html#pygame.mouse.get_pos

and check if the mouse's position is in that rect using Rect.collidepoint():
http://www.pygame.org/docs/ref/rect.html#Rect.collidepoint

If it is, execute the function for that level.

Good luck!

On Mon, May 9, 2011 at 2:43 AM, ANKUR AGGARWAL <[email protected]>wrote:

> I am getting some trouble with the mouse focus too.
> I have render the text on the screen like-
> level1
> level2
> level3
>
> I want an  algo that when i click on level1 , it executes the level1 . I am
> unable to focus on the text too . Please give me an algo for it
> Thanks in Advance
> Ankur Aggarwal
>

Reply via email to