[Python] How can I get a screenshot on Wayland with pure Python?

Discussão em 'Python' iniciado por Stack, Julho 14, 2025.

  1. Stack

    Stack Membro Participativo

    As of the latest Pillow version (9.1.0), the grab() function to get a screenshot only works on X11 and not Wayland. When I disable Wayland, it works fine.

    How can I get screenshot on Wayland with pure Python? Ideally the solution doesn't involve relying on other libraries.

    Is this even possible for an app to get a full screenshot (including the windows of other apps) given Wayland's security model? Using scrot to get a screenshot results in a completely black image (similar to the issue here). However, gnome-screenshot works just fine so I know this is possible.

    Continue reading...

Compartilhe esta Página