Get the clipboard's text on OS X.
()
| 33 | return text |
| 34 | |
| 35 | def osx_clipboard_get() -> str: |
| 36 | """ Get the clipboard's text on OS X. |
| 37 | """ |
| 38 | p = subprocess.Popen(['pbpaste', '-Prefer', 'ascii'], |
| 39 | stdout=subprocess.PIPE) |
| 40 | bytes_, stderr = p.communicate() |
| 41 | # Text comes in with old Mac \r line endings. Change them to \n. |
| 42 | bytes_ = bytes_.replace(b'\r', b'\n') |
| 43 | text = py3compat.decode(bytes_) |
| 44 | return text |
| 45 | |
| 46 | def tkinter_clipboard_get(): |
| 47 | """ Get the clipboard's text using Tkinter. |
nothing calls this directly
no outgoing calls
no test coverage detected