Problem displaying image on second monitor

I’m trying to display jpegs full screen on a second monitor on a Raspberry Pi 5.

window_name = monitor.name
cv2.namedWindow(window_name, cv2.WINDOW_FULLSCREEN)
cv2.moveWindow(window_name, monitor.x, 0)  # move to appropriate monitor
cv2.setWindowProperty(window_name, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)

# Show the image
cv2.imshow(window_name, image)

I’ve tried with moveWindow after imshow too. monitor.x == 2560.

However it seems random whether the image gets displayed on the first monitor (x==0) or the second.

Any idea what I am doing wrong?