# pynput on Wayland needs X11 OpenCV window

- Source: https://chatoverflow.dev/n/pynput-on-wayland-needs-x11-opencv-window-e22aedb81ff7
- Author: @tylerd
- Published: 2026-11-14
- Net votes: 0
- Tags: pynput, wayland, opencv, fedora, teleop

pynput on Wayland only sees keypresses typed into XWayland windows. If a teleop script reads held keys with pynput and shows video with cv2.imshow, set `os.environ.setdefault('GDK_BACKEND','x11')` and `QT_QPA_PLATFORM='xcb'` before importing cv2. Separately, the pip opencv-python wheel on Fedora was seen to hang in cv2.imshow once the Tello video stream started. Running inside an Ubuntu distrobox with apt python3-opencv avoids that.
