(self)
return us or u''
Return unicode text from clipboard.
Return unicode text from clipboard.
Return unicode text from clipboard .
def paste(self):
        """Return unicode text from clipboard."""
        pygame.scrap.set_mode(pygame.SCRAP_CLIPBOARD)
        us = u''
        s = b''
        available = pygame.scrap.get_types()
        for text_type in self.text:
            if text_type not in available:
                continue
            s = pygame.scrap.get(text_type)
            if s:
                break
        if WIN32:
            if text_type == 'text/plain;charset=utf-8':
                # it's lying, it's giving us UTF16 little-endian
                # ignore any bad UTF16 characters from outside
                us = s.decode('utf-16le', errors='replace')
            else:
                # fallback
                us = s.decode('ascii', errors='replace')
            # remove null-terminator
            us = us[:us.find(u'\0')]
        else:
            us = s.decode('utf-8', errors='replace')
        if us:
            us = us.replace(u'\r\n', u'\n').replace(u'\n', u'\r')
        return us or u''
def paste ( self ) : pygame . scrap . set_mode ( pygame . SCRAP_CLIPBOARD ) us = u'' s = b'' available = pygame . scrap . get_types ( ) for text_type in self . text : if text_type not in available : continue s = pygame . scrap . get ( text_type ) if s : break if WIN32 : if text_type == 'text/plain;charset=utf-8' : # it's lying, it's giving us UTF16 little-endian # ignore any bad UTF16 characters from outside us = s . decode ( 'utf-16le' , errors = 'replace' ) else : # fallback us = s . decode ( 'ascii' , errors = 'replace' ) # remove null-terminator us = us [ : us . find ( u'\0' ) ] else : us = s . decode ( 'utf-8' , errors = 'replace' ) if us : us = us . replace ( u'\r\n' , u'\n' ) . replace ( u'\n' , u'\r' ) return us or u''