Screen to the full screen without pressing 'f'

If you look at the code, you can see that it switches to full screen by pressing ‘f’. What I want is to be a full screen without pressing F key.

cv2.setWindowProperty(window_name, cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)

I know I can use this part, but I don’t know where to put it.

Where and how should I put it?