home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import subprocess
- import sys
- from IPython.ipapi import TryNext
-
- def win32_clipboard_get():
-
- try:
- import win32clipboard
- except ImportError:
- message = 'Getting text from the clipboard requires the pywin32 extensions: http://sourceforge.net/projects/pywin32/'
- raise TryNext(message)
-
- win32clipboard.OpenClipboard()
- text = win32clipboard.GetClipboardData(win32clipboard.CF_TEXT)
- win32clipboard.CloseClipboard()
- return text
-
-
- def osx_clipboard_get():
- p = subprocess.Popen([
- 'pbpaste',
- '-Prefer',
- 'ascii'], stdout = subprocess.PIPE)
- (text, stderr) = p.communicate()
- text = text.replace('\r', '\n')
- return text
-
-
- def tkinter_clipboard_get():
-
- try:
- import Tkinter
- except ImportError:
- message = 'Getting text from the clipboard on this platform requires Tkinter.'
- raise TryNext(message)
-
- root = Tkinter.Tk()
- root.withdraw()
- text = root.clipboard_get()
- root.destroy()
- return text
-
-