the lefttopcoordsofbox(function will take box coordinates and return pixel coordinates because box takes up multiple pixels on the screenwe will always return the single pixel at the top left corner of the box this value will be returned as two-integer tuple the lefttopcoordsofbox(function will often be used when we need pixel coordinates for drawing these boxes converting from pixel coordinates to box coordinates def getboxatpixel(xy) for boxx in range(boardwidth) for boxy in range(boardheight) lefttop lefttopcoordsofbox(boxxboxy boxrect pygame rect(lefttopboxsizeboxsize if boxrect collidepoint(xy) return (boxxboxy return (nonenonewe will also need function to convert from pixel coordinates (which the mouse clicks and mouse movement events useto box coordinates (so we can find out over which box the mouse event happenedrect objects have collidepoint(method that you can pass and coordinates too and it will return true if the coordinates are inside (that iscollide withthe rect object' area email questions to the authoral@inventwithpython com