In a Grid Widget, you would like to show 24 Pages in your widget. You set the 'Number of Items' to 24.
When using a Grid Widget for Photo Gallery the 'Number of Items' displays the total number of images that appear in the popup Lightbox gallery, not the number of thumbnail images on the page. As standard the Gallery Widget displays 2 rows of thumbnails, you can choose how many columns you wish your gallery to have.
Therefore, if you set the 'Number of Items' to 24, and the number of columns to 6, then 12 (2 rows of 6) thumbnail Images will appear on the page, then when you click on an image to open up the Lightbox, then you will be able to scroll through all 24 images.