Limiting the game size

So I want to make the smallest that the game can be is like a 500x500 and the biggest 1000x1000

Like the game window you know

There are expressions to get the window size and actions to change it. Simply check the height/width and if it exceeds a certain threshold it is set back to the range of authorized values.