Created
January 17, 2020 07:26
-
-
Save Lu-Yi-Hsun/26de1fc57c19e72166105402f5247056 to your computer and use it in GitHub Desktop.
dict
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
#!/usr/bin/python | |
try: | |
# Python2 | |
import Tkinter as tk | |
except ImportError: | |
# Python3 | |
import tkinter as tk | |
import os | |
import time | |
root = tk.Tk() | |
# keep the window from showing | |
root.withdraw() | |
# read the clipboard | |
table=None | |
while True: | |
try: | |
get_clipb=root.selection_get(selection="CLIPBOARD") | |
if table!=get_clipb: | |
check_ok=False | |
os.system("trans --speak :zh-TW \""+get_clipb+"\"") | |
table=get_clipb | |
# | |
except: | |
get_clipb=None | |
time.sleep(0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment