(self, text)
Put unicode text on clipboard.
Put unicode text on clipboard.
Put unicode text on clipboard .
def copy(self, text):
        """Put unicode text on clipboard."""
        pygame.scrap.set_mode(pygame.SCRAP_CLIPBOARD)
        try:
            if WIN32:
                # on Windows, encode as utf-16 without FF FE byte order mark and null-terminate
                # but give it a utf-8 MIME type, because that's how Windows likes it
                pygame.scrap.put(
                    'text/plain;charset=utf-8', text.encode('utf-16le', 'replace') + b'\0\0'
                )
            else:
                pygame.scrap.put(pygame.SCRAP_TEXT, text.encode('utf-8', 'replace'))
        except Exception as e:# KeyError:
            logging.debug('Clipboard copy failed for clip %r: %s', text, e)
def copy ( self , text ) : pygame . scrap . set_mode ( pygame . SCRAP_CLIPBOARD ) try : if WIN32 : # on Windows, encode as utf-16 without FF FE byte order mark and null-terminate # but give it a utf-8 MIME type, because that's how Windows likes it pygame . scrap . put ( 'text/plain;charset=utf-8' , text . encode ( 'utf-16le' , 'replace' ) + b'\0\0' ) else : pygame . scrap . put ( pygame . SCRAP_TEXT , text . encode ( 'utf-8' , 'replace' ) ) except Exception as e : # KeyError: logging . debug ( 'Clipboard copy failed for clip %r: %s' , text , e )