Skip to content

Instantly share code, notes, and snippets.

View sri's full-sized avatar

Sriram Thaiyar sri

  • Bay Area, CA
View GitHub Profile
# How to access Clipboard data in Windows from Python 3
def win32_clipboard():
import ctypes
ctypes.windll.user32.OpenClipboard(None)
pc = ctypes.windll.user32.GetClipboardData(1)
return ctypes.c_char_p(pc).value
def win32_clipboard_paste(txt):
import ctypes
ctypes.windll.user32.OpenClipboard(None)