Skip to content

pygame.scrap and clipboard access #3320

@clach04

Description

@clach04

I'm not 100% what the support status is of pygame.scrap.get(), specifically for reading text clipboard content.

Under Microsoft Windows 10, with Python 3.12.5 64-bit and pygame-c 2.5.2 the text support is returned from pygame.scrap.get_types() is:

'text/plain;charset=utf-8'

But when calling:

pygame.scrap.get('text/plain;charset=utf-8')

The result is utf-16-le, with a NUL terminator (i.e. 0x0000) and not utf-8 which .

Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug  6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame-ce 2.5.2 (SDL 2.30.8, Python 3.12.5)
>>> pygame.version
<module 'pygame.version' from 'C:\\code\\py\\PyDPainter\\py3venv\\Lib\\site-packages\\pygame\\version.py'>
>>> pygame.__version__
'2.5.2'

I'm not sure as I can see a number of older tickets:

When I look at the scrap.pyi and rst documentation that gets installed via pip it mentions 2.2.0 deprecations (same when looking at the C code) BUT I'm not seeing any warning messages when using those older API calls.

clipboard_text = pygame.scrap.get_text()

works great, so I'm up and running but not sure if I should have seen warnings at runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions