Use a reed switch and program a simulated alarm system. If a magnet is near the reed switch, everything is OK. If the magnet is removed, a LED is flashing (or a buzzer sounds). In reality, the reed switch is integrated in the window frame and the magnet in the wing (the alarm is triggered when the window is opened).
As additional assignment, the alarm is set “life” with the button A and deactivated with the button B.
If you need any help, take a look into the worksheet or watch the tutorials.