<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def OnResizeGrid(self, event):
 """Event handler for grid resizing"""


        shape = min(event.shape[2], 2**30)
        self.SetItemCount(shape)
        event.Skip()