Skip to content

Commit 94cb2ad

Browse files
committed
fix clipboard_pygame.py to encode only for py2
1 parent 56572b5 commit 94cb2ad

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kivy/core/clipboard/clipboard_pygame.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
__all__ = ('ClipboardPygame', )
66

77
from kivy.utils import platform
8+
from kivy.compat import PY2
89
from kivy.core.clipboard import ClipboardBase
910

1011
if platform not in ('win', 'linux', 'macosx'):
@@ -29,7 +30,11 @@ def init(self):
2930

3031
def get(self, mimetype='text/plain'):
3132
self.init()
32-
return pygame.scrap.get(mimetype).encode('utf-8')
33+
text = pygame.scrap.get(mimetype)
34+
if PY2:
35+
text = text.encode('utf-8')
36+
37+
return text
3338

3439
def put(self, data, mimetype='text/plain'):
3540
self.init()
@@ -40,3 +45,4 @@ def put(self, data, mimetype='text/plain'):
4045
def get_types(self):
4146
self.init()
4247
return pygame.scrap.get_types()
48+

0 commit comments

Comments
 (0)