Last active
August 29, 2015 14:00
-
-
Save krets/11127896 to your computer and use it in GitHub Desktop.
ach, whitespace.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Flip slashes in ClipBoard | |
Now using Tk, so it should be cross-platform. | |
http://stackoverflow.com/questions/579687 | |
""" | |
from Tkinter import Tk | |
w = Tk() # create window object | |
w.withdraw() # hide window from view. | |
def getClipboard(): | |
return w.selection_get(selection = "CLIPBOARD") | |
def setClipboard(text): | |
w.clipboard_clear() | |
w.clipboard_append(text) | |
def main(): | |
c=getClipboard() | |
if c.find('/')>-1: | |
c=c.replace('/','\\') | |
else: | |
c=c.replace('\\','/') | |
setClipboard(c) | |
if __name__=='__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment