Skip to content

Instantly share code, notes, and snippets.

@Lu-Yi-Hsun
Created January 17, 2020 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lu-Yi-Hsun/26de1fc57c19e72166105402f5247056 to your computer and use it in GitHub Desktop.
Save Lu-Yi-Hsun/26de1fc57c19e72166105402f5247056 to your computer and use it in GitHub Desktop.
dict
#!/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