import pygame
from gtts import gTTS
import os
import time
import sys
import platform
# 初始化 pygame
pygame.init()
pygame.mixer.init()
# 設置顯示窗口大小
screen_width, screen_height = 480, 720
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption('Word Learning')
# 定義顏色
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
BLUE = (0, 0, 255)
GREEN = (0, 180, 0)
RED = (200, 0, 0)
GRAY = (200, 200, 200)
# 檢測系統類型
system = platform.system()
print(f"Detected system: {system}")
# 確定是否在Android上運行
is_android = False
if hasattr(sys, 'getandroidapilevel'):
is_android = True
print("Running on Android")
# 根據不同系統加載合適的字體
chinese_font_loaded = False
try:
if system == "Windows":
# Windows中文字體
potential_fonts = ["simsun.ttc", "msyh.ttc", "simhei.ttf"]
for font_name in potential_fonts:
font_path = os.path.join("C:/Windows/Fonts", font_name)
if os.path.exists(font_path):
font_large = pygame.font.Font(font_path, 42)
font = pygame.font.Font(font_path, 32)
font_small = pygame.font.Font(font_path, 24)
chinese_font_loaded = True
print(f"Loaded Windows font: {font_path}")
break
elif system == "Darwin": # macOS
# macOS中文字體
font_path = "/System/Library/Fonts/PingFang.ttc"
if os.path.exists(font_path):
font_large = pygame.font.Font(font_path, 42)
font = pygame.font.Font(font_path, 32)
font_small = pygame.font.Font(font_path, 24)
chinese_font_loaded = True
print(f"Loaded macOS font: {font_path}")
elif is_android:
# Android中文字體
android_fonts = [
"/system/fonts/NotoSansCJK-Regular.ttc",
"/system/fonts/DroidSansFallback.ttf"
]
for font_path in android_fonts:
if os.path.exists(font_path):
font_large = pygame.font.Font(font_path, 42)
font = pygame.font.Font(font_path, 32)
font_small = pygame.font.Font(font_path, 24)
chinese_font_loaded = True
print(f"Loaded Android font: {font_path}")
break
elif system == "Linux":
# Linux中文字體
linux_fonts = [
"/usr/share/fonts/truetype/arphic/uming.ttc",
"/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc"
]
for font_path in linux_fonts:
if os.path.exists(font_path):
font_large = pygame.font.Font(font_path, 42)
font = pygame.font.Font(font_path, 32)
font_small = pygame.font.Font(font_path, 24)
chinese_font_loaded = True
print(f"Loaded Linux font: {font_path}")
break
except Exception as e:
print(f"Error loading Chinese font: {e}")
chinese_font_loaded = False
# 如果無法加載中文字體,使用系統默認字體
if not chinese_font_loaded:
print("Could not load Chinese font, using default font")
font_large = pygame.font.SysFont(None, 42)
font = pygame.font.SysFont(None, 32)
font_small = pygame.font.SysFont(None, 24)
# 定義單詞列表
words = [
{"english": "clarify", "chinese": "闡明"},
{"english": "condition", "chinese": "條件"},
{"english": "conflict resolution", "chinese": "衝突解決"},
{"english": "consumer rights", "chinese": "消費者權益"},
{"english": "cooling off period", "chinese": "冷靜期"},
{"english": "defective", "chinese": "有缺陷的"},
{"english": "disclose", "chinese": "披露"},
{"english": "go the extra mile", "chinese": "付出更多努力"},
{"english": "identical", "chinese": "完全相同的"},
{"english": "last straw", "chinese": "最後一根稻草"},
{"english": "opportunity", "chinese": "機會"},
{"english": "perspective", "chinese": "觀點"},
{"english": "Permanent", "chinese": "永恆的"},
{"english": "prominent", "chinese": "顯著的"},
{"english": "rule out", "chinese": "排除"},
{"english": "store credit", "chinese": "購物抵用金"}
]
words = [
{"english": "administrator", "chinese": "管理員"},
{"english": "biotechnology", "chinese": "生物技術"},
{"english": "critical",
"chinese": "危急的;臨界的;關鍵的;批判的"},
{"english": "deductible", "chinese": "免賠額(名詞)"},
{"english": "deduct", "chinese": "扣除;減去"},
{"english": "deduce", "chinese": "推斷;推論"},
{"english": "reduce", "chinese": "減少;降低"},
{"english": "infer", "chinese": "推斷;推測"},
{"english": "implant", "chinese": "植入"},
{"english": "plant", "chinese": "植物;種植"},
{"english": "imply", "chinese": "暗示;意味著"},
{"english": "implement", "chinese": "實施;工具(動詞 名詞)"},
{"english": "medical malpractice", "chinese": "醫療事故"},
{"english": "medical tourism", "chinese": "醫療旅遊"},
{"english": "nutritious", "chinese": "有營養的"},
{"english": "patient-centered", "chinese": "以患者為中心的"},
{"english": "pharmaceutical representative", "chinese": "醫藥代表"},
{"english": "scheduler", "chinese": "安排人"},
{"english": "state-of-the-art", "chinese": "最先進的"},
{"english": "cutting-edge", "chinese": "尖端的、最前沿的"},
{"english": "leading-edge", "chinese": "領先的、最先進的"},
{"english": "bleeding-edge", "chinese": "極尖端的、最新穎的"},
{"english": "bleeding", "chinese": "流血的;極度的"},
{"english": "insure", "chinese": "投保、保險"},
{"english": "ensure", "chinese": "確保、保證"},
{"english": "assure", "chinese": "向...保證、使安心"},
{"english": "insurance", "chinese": "保險"},
{"english": "insured", "chinese": "已投保的、被保險人"},
{"english": "uninsured", "chinese": "未投保的、無保險的"},
{"english": "insurer", "chinese": "保險公司、承保人"},
{"english": "insurant", "chinese": "投保人、被保險人"},
{"english": "insurable", "chinese": "可保險的"},
{"english": "reinsure", "chinese": "再保險"},
{"english": "underinsured", "chinese": "保險不足的"},
{"english": "policy", "chinese": "保單、政策"},
{"english": "insurance policy", "chinese": "保險單"},
{"english": "utilize", "chinese": "利用"},
{"english": "utilization", "chinese": "利用;使用"},
{"english": "utility", "chinese": "效用;工具;公用事業"},
{"english": "nutrition", "chinese": "營養"},
{"english": "nutritionist",
"chinese": "營養學家;營養專家"},
{"english": "diet", "chinese": "飲食、節食"},
{"english": "dietitian", "chinese": "營養師"},
{"english": "dietician", "chinese": "營養師(另一種拼法)"},
{"english": "dietary", "chinese": "飲食的、膳食的"},
{"english": "dieter", "chinese": "節食者"},
{"english": "dieting", "chinese": "節食、減肥"},
{"english": "dietetics", "chinese": "營養學"},
{"english": "balanced diet", "chinese": "均衡飲食"},
{"english": "go on a diet", "chinese": "開始節食"},
{"english": "dietary fiber", "chinese": "膳食纖維"},
{"english": "dietary supplement", "chinese": "膳食補充劑"},
{"english": "low-fat diet", "chinese": "低脂飲食"},
{"english": "vegetarian diet", "chinese": "素食"},
{"english": "ketogenic diet", "chinese": "生酮飲食"},
{"english": "contaminated", "chinese": "受污染的"},
{"english": "contagious", "chinese": "傳染性的"},
{"english": "physician", "chinese": "醫生(通常指內科醫生)"},
{"english": "surgeon", "chinese": "外科醫生"},
{"english": "doctor", "chinese": "醫生(通稱)"},
{"english": "internist", "chinese": "內科醫生"},
{"english": "general practitioner (GP)",
"chinese": "全科醫生、家庭醫生"},
{"english": "supplement", "chinese": "補充劑"},
{"english": "stethoscope", "chinese": "聽診器"},
{"english": "physiotherapist",
"chinese": "物理治療師"},
{"english": "diagnosis", "chinese": "診斷(名詞)"},
{"english": "diagnose", "chinese": "診斷(動詞)"},
{"english": "diagnostic", "chinese": "診斷的(形容詞)"},
{"english": "diagnostics", "chinese": "診斷學、診斷方法"},
{"english": "diagnosed", "chinese": "被診斷的"},
{"english": "misdiagnose", "chinese": "誤診"},
{"english": "misdiagnosis", "chinese": "誤診(名詞)"},
{"english": "prognosis", "chinese": "預後、預測"},
{"english": "volunteer", "chinese": "志願者"},
{"english": "therapist", "chinese": "治療師"},
{"english": "hand sanitizer", "chinese": "洗手液"},
{"english": "skin test", "chinese": "皮膚測試"},
{"english": "medical devices", "chinese": "醫療設備"},
{"english": "abnormal", "chinese": "異常的"},
{"english": "norm", "chinese": "常規"},
{"english": "coherent", "chinese": "連貫的"},
{"english": "consequence", "chinese": "結果、後果"},
{"english": "sequence", "chinese": "順序、序列"},
{"english": "consequent", "chinese": "隨之而來的、結果的"},
{"english": "sequential", "chinese": "連續的、按順序的"},
{"english": "subsequently", "chinese": "隨後、後來"},
{"english": "consequently", "chinese": "因此、所以"},
{"english": "sequel", "chinese": "續集、續篇"},
{"english": "subsequent", "chinese": "隨後的、後續的"},
{"english": "inconsequential", "chinese": "無關緊要的"},
{"english": "in sequence", "chinese": "按順序"},
{"english": "out of sequence", "chinese": "順序錯亂"},
{"english": "courtesy", "chinese": "禮貌"},
{"english": "curiosity", "chinese": "好奇心"},
{"english": "designate", "chinese": "指定"},
{"english": "essential", "chinese": "必要的"},
{"english": "fad", "chinese": "一時的流行"},
{"english": "hesitant", "chinese": "猶豫的"},
{"english": "obligatory", "chinese": "必須的"},
{"english": "optimize", "chinese": "優化"},
{"english": "optimum", "chinese": "最優化的"},
{"english": "optimus", "chinese": "擎天柱"},
{"english": "requisite", "chinese": "必要的"},
{"english": "require", "chinese": "需要"},
{"english": "respect", "chinese": "尊重"},
{"english": "esteem", "chinese": "尊敬、敬重"},
{"english": "taboo", "chinese": "禁忌"},
{"english": "taco", "chinese": "墨西哥玉米餅"},
{"english": "unambiguous", "chinese": "清晰的"},
{"english": "convinced", "chinese": "被說服的、確信的"},
{"english": "convince", "chinese": "使確信、說服"},
{"english": "persuade", "chinese": "說服"},
{"english": "patience", "chinese": "耐心"},
{"english": "forbid", "chinese": "禁止"},
{"english": "congratulated", "chinese": "祝賀"},
{"english": "conscious", "chinese": "有意識的(形容詞)"},
{"english": "consciousness", "chinese": "意識、知覺(名詞)"},
{"english": "unconscious", "chinese": "無意識的、昏迷的"},
{"english": "unconsciousness", "chinese": "無意識、昏迷狀態"},
{"english": "subconscious", "chinese": "潛意識的"},
{"english": "subconsciousness", "chinese": "潛意識"},
{"english": "self-conscious", "chinese": "害羞的、不自在的"},
{"english": "self-consciousness", "chinese": "害羞、不自在"},
{"english": "conscience", "chinese": "良心"},
{"english": "conscientious", "chinese": "有良心的、盡責的、認真的"},
{"english": "conscienceless", "chinese": "沒良心的、無良心的"},
{"english": "unconscionable", "chinese": "沒良心的、不合理的"},
{"english": "irritate", "chinese": "惹惱"},
{"english": "correspondence", "chinese": "通信"},
{"english": "appreciation", "chinese": "感激"},
{"english": "interactive", "chinese": "互動的"},
{"english": "attentive", "chinese": "專心的、細心的、留心的"},
{"english": "attentive", "chinese": "專心的、細心的、留心的"},
{"english": "attend", "chinese": "出席、參加、照料、注意"},
{"english": "attention", "chinese": "注意、注意力、關注"},
{"english": "attendance", "chinese": "出席、出勤"},
{"english": "attendant", "chinese": "服務員、隨從"},
{"english": "attendee", "chinese": "出席者、參加者"},
{"english": "inattentive", "chinese": "不專心的"},
{"english": "inattention", "chinese": "不注意、疏忽"},
{"english": "unique", "chinese": "獨特的"},
{"english": "patient", "chinese": "病人、耐心的"},
{"english": "patience", "chinese": "耐心"},
{"english": "therapy", "chinese": "治療、療法"},
{"english": "therapist", "chinese": "治療師"},
{"english": "physics", "chinese": "物理學"},
{"english": "physicist", "chinese": "物理學家"},
{"english": "physiotherapist", "chinese": "物理治療師"},
{"english": "pharmacy", "chinese": "藥房、藥學"},
{"english": "pharmacist", "chinese": "藥劑師"},
{"english": "diagonal", "chinese": "對角線的"},
{"english": "diagnosis", "chinese": "診斷"},
{"english": "supplement", "chinese": "補充劑"},
{"english": "supplemental", "chinese": "補充的"},
{"english": "complementary", "chinese": "互補的"},
{"english": "supplement", "chinese": "補充劑、補充"},
{"english": "supple", "chinese": "柔軟的、柔韌的、靈活的"},
{"english": "supplementary", "chinese": "補充的、附加的"},
{"english": "supplemental", "chinese": "補充的、追加的"},
{"english": "suppleness", "chinese": "柔軟、柔韌性"},
{"english": "supply", "chinese": "供應、提供"},
{"english": "optimal", "chinese": "最佳的"},
{"english": "optimize", "chinese": "優化"},
{"english": "optimum", "chinese": "最優化的"},
{"english": "hesitate", "chinese": "猶豫"},
{"english": "hesitant", "chinese": "猶豫的"},
{"english": "hesitation", "chinese": "猶豫"},
{"english": "irritation", "chinese": "刺激、惱怒"},
{"english": "irritate", "chinese": "惹惱"},
{"english": "irrigation", "chinese": "灌溉"},
{"english": "appreciate", "chinese": "感激、欣賞"},
{"english": "appreciation", "chinese": "感激"},
{"english": "depreciate", "chinese": "貶值"},
{"english": "correspondent", "chinese": "通訊員、記者"},
{"english": "correspondence", "chinese": "通信"},
{"english": "corresponding", "chinese": "相應的"},
{"english": "enthusiastic", "chinese": "熱情的"},
{"english": "enthusiasm", "chinese": "熱情"},
{"english": "deficient", "chinese": "缺乏的"},
{"english": "deficiency", "chinese": "缺乏"},
{"english": "efficient", "chinese": "有效率的"},
{"english": "efficiency", "chinese": "效率"}
]
# 定義音頻文件保存路徑
audio_dir = "audio_files"
if not os.path.exists(audio_dir):
os.makedirs(audio_dir)
# 定義中英文按鈕標籤
button_labels = {
"prev": {"en": "PREV", "zh": "上一個"},
"play": {"en": "PLAY", "zh": "播放"},
"next": {"en": "NEXT", "zh": "下一個"},
"auto": {"en": "AUTO", "zh": "自動播放"},
"stop_auto": {"en": "STOP", "zh": "停止自動"},
"exit": {"en": "EXIT", "zh": "退出"},
"instructions": {"en": "Instructions:", "zh": "操作說明:"},
"play_instruction": {"en": "PLAY - Play current word", "zh": "播放 - 播放當前單詞"},
"nav_instruction": {"en": "PREV/NEXT - Change word", "zh": "上一個/下一個 - 切換單詞"},
"auto_instruction": {"en": "AUTO - Play all words", "zh": "自動播放 - 連續播放所有單詞"},
"click_to_see": {"en": "(Click PLAY to see translation)", "zh": "(點擊播放按鈕查看翻譯)"},
"word_count": {"en": "Word", "zh": "單詞"},
"generating": {"en": "Generating audio files...", "zh": "正在生成音頻檔案..."},
"generated": {"en": "Audio files generated!", "zh": "音頻檔案生成完成!"}
}
# 定義按鈕類
class Button:
def __init__(self, x, y, width, height, key, color=BLUE, hover_color=GREEN):
self.rect = pygame.Rect(x, y, width, height)
self.key = key
self.color = color
self.hover_color = hover_color
self.current_color = color
def draw(self):
# 繪製按鈕
pygame.draw.rect(screen, self.current_color, self.rect, border_radius=10)
pygame.draw.rect(screen, BLACK, self.rect, 2, border_radius=10)
# 根據是否支持中文選擇顯示文本
lang = "zh" if chinese_font_loaded and not is_android else "en"
text = button_labels[self.key][lang]
text_surface = font.render(text, True, WHITE)
text_rect = text_surface.get_rect(center=self.rect.center)
screen.blit(text_surface, text_rect)
def is_clicked(self, pos):
return self.rect.collidepoint(pos)
def update(self, mouse_pos):
# 更新按鈕顏色(懸停效果)
if self.rect.collidepoint(mouse_pos):
self.current_color = self.hover_color
else:
self.current_color = self.color
# 將單詞轉換為音頻文件
def generate_audio(word, language, filename):
filepath = os.path.join(audio_dir, filename)
if not os.path.exists(filepath): # 只有在文件不存在時才生成
try:
tts = gTTS(text=word, lang=language)
tts.save(filepath)
print(f"Generated: {filename}")
return filepath
except Exception as e:
print(f"Error generating audio: {e}")
return None
return filepath
# 播放音頻文件
def play_audio(filepath):
if filepath and os.path.exists(filepath):
try:
pygame.mixer.music.load(filepath)
pygame.mixer.music.play()
# 等待音頻播放完成,但設置超時
start_time = pygame.time.get_ticks()
while pygame.mixer.music.get_busy():
pygame.time.Clock().tick(10)
# 如果播放超過5秒,強制停止(防止卡住)
if pygame.time.get_ticks() - start_time > 5000:
pygame.mixer.music.stop()
print("Audio timeout, stopped")
break
except Exception as e:
print(f"Error playing audio: {e}")
# 在屏幕上顯示文字
def display_text(key, y_position, font_to_use=font, color=BLACK, center_x=None, count=None):
try:
# 如果是帶有計數的文本
if count is not None:
lang = "zh" if chinese_font_loaded and not is_android else "en"
base_text = button_labels[key][lang]
text = f"{base_text} {count}"
# 如果是普通的帶有翻譯的文本
elif key in button_labels:
lang = "zh" if chinese_font_loaded and not is_android else "en"
text = button_labels[key][lang]
# 如果是直接的文本
else:
text = key
text_surface = font_to_use.render(text, True, color)
if center_x is None:
center_x = screen_width // 2
text_rect = text_surface.get_rect(center=(center_x, y_position))
screen.blit(text_surface, text_rect)
except Exception as e:
print(f"Error displaying text: {e}")
# 顯示加載進度
def show_loading_screen(progress, total):
try:
screen.fill(WHITE)
display_text("generating", 300, font_large, BLUE)
display_text(f"{progress}/{total}", 350, font, BLUE)
# 進度條
progress_width = 300
progress_height = 30
outline_rect = pygame.Rect((screen_width - progress_width) // 2, 400, progress_width, progress_height)
fill_width = int(progress_width * (progress / total))
fill_rect = pygame.Rect((screen_width - progress_width) // 2, 400, fill_width, progress_height)
pygame.draw.rect(screen, GREEN, fill_rect)
pygame.draw.rect(screen, BLACK, outline_rect, 2)
pygame.display.flip()
except Exception as e:
print(f"Error showing loading screen: {e}")
# 主程序
def main():
current_index = 0
show_chinese = False
is_playing = False
auto_play = False
# 創建按鈕
button_width = 120
button_height = 60
prev_button = Button(30, screen_height - 100, button_width, button_height, "prev", BLUE)
play_button = Button((screen_width - button_width) // 2, screen_height - 100, button_width, button_height, "play", GREEN)
next_button = Button(screen_width - 30 - button_width, screen_height - 100, button_width, button_height, "next", BLUE)
auto_button = Button((screen_width - button_width) // 2, screen_height - 180, button_width, button_height, "auto", RED)
exit_button = Button(screen_width - 100, 30, 80, 40, "exit", RED)
buttons = [prev_button, play_button, next_button, auto_button, exit_button]
# 預先生成部分音頻文件
print("Generating audio files...")
total_files = min(10, len(words)) * 2 # 只為前10個單詞生成音頻
progress = 0
# 生成音頻文件
audio_files = {}
for i, word in enumerate(words):
try:
# 更新加載進度
show_loading_screen(progress, total_files)
progress += 1
english_file = f"{word['english']}_en.mp3"
english_path = generate_audio(word["english"], "en", english_file)
audio_files[english_file] = english_path
# 更新加載進度
show_loading_screen(progress, total_files)
progress += 1
chinese_file = f"{word['english']}_zh.mp3"
chinese_path = generate_audio(word["chinese"], "zh", chinese_file)
audio_files[chinese_file] = chinese_path
# 只生成前5個單詞的音頻,其他的稍後按需生成
if i >= 4:
break
except Exception as e:
print(f"Error in generation: {e}")
print("Initial audio files generated!")
# 主循環
running = True
clock = pygame.time.Clock()
last_auto_time = pygame.time.get_ticks()
while running:
try:
current_time = pygame.time.get_ticks()
mouse_pos = pygame.mouse.get_pos()
# 處理自動播放
if auto_play and not is_playing and current_time - last_auto_time > 3000: # 3秒間隔
is_playing = True
show_chinese = True
last_auto_time = current_time
current_word = words[current_index]
english_file = f"{current_word['english']}_en.mp3"
chinese_file = f"{current_word['english']}_zh.mp3"
# 確保音頻文件存在
if english_file not in audio_files or not audio_files[english_file]:
audio_files[english_file] = generate_audio(current_word["english"], "en", english_file)
if chinese_file not in audio_files or not audio_files[chinese_file]:
audio_files[chinese_file] = generate_audio(current_word["chinese"], "zh", chinese_file)
play_audio(audio_files[english_file])
time.sleep(0.8)
play_audio(audio_files[chinese_file])
# 播放完成後自動前進到下一個單詞
current_index = (current_index + 1) % len(words)
is_playing = False
# 事件處理
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1: # 左鍵點擊
for button in buttons:
if button.is_clicked(event.pos):
if button == play_button and not is_playing:
is_playing = True
show_chinese = True
current_word = words[current_index]
english_file = f"{current_word['english']}_en.mp3"
chinese_file = f"{current_word['english']}_zh.mp3"
# 確保音頻文件存在
if english_file not in audio_files or not audio_files[english_file]:
audio_files[english_file] = generate_audio(current_word["english"], "en", english_file)
if chinese_file not in audio_files or not audio_files[chinese_file]:
audio_files[chinese_file] = generate_audio(current_word["chinese"], "zh", chinese_file)
play_audio(audio_files[english_file])
time.sleep(0.8)
play_audio(audio_files[chinese_file])
is_playing = False
elif button == prev_button:
current_index = (current_index - 1) % len(words)
show_chinese = False
elif button == next_button:
current_index = (current_index + 1) % len(words)
show_chinese = False
elif button == auto_button:
auto_play = not auto_play
if auto_play:
auto_button.key = "stop_auto"
auto_button.color = GREEN
else:
auto_button.key = "auto"
auto_button.color = RED
elif button == exit_button:
running = False
# 更新界面
screen.fill(WHITE)
# 更新按鈕懸停狀態
for button in buttons:
button.update(mouse_pos)
# 顯示當前單詞
current_word = words[current_index]
display_text("word_count", 60, font, BLUE, None, f"{current_index+1}/{len(words)}")
# 英文單詞直接顯示
eng_text_surface = font_large.render(current_word["english"], True, BLACK)
eng_text_rect = eng_text_surface.get_rect(center=(screen_width // 2, 150))
screen.blit(eng_text_surface, eng_text_rect)
# 中文翻譯只在需要時顯示
if show_chinese:
# 根據是否支持中文直接顯示或使用拼音
if chinese_font_loaded:
chinese_text_surface = font_large.render(current_word["chinese"], True, BLACK)
chinese_text_rect = chinese_text_surface.get_rect(center=(screen_width // 2, 220))
screen.blit(chinese_text_surface, chinese_text_rect)
else:
# 如果不支持中文,顯示拼音版本
pinyin_mapping = {
"闡明": "Chan Ming",
"條件": "Tiao Jian",
"衝突解決": "Chong Tu Jie Jue",
"消費者權益": "Xiao Fei Zhe Quan Yi",
"冷靜期": "Leng Jing Qi",
"有缺陷的": "You Que Xian De",
"披露": "Pi Lu",
"付出更多努力": "Fu Chu Geng Duo Nu Li",
"完全相同的": "Wan Quan Xiang Tong De",
"最後一根稻草": "Zui Hou Yi Gen Dao Cao",
"機會": "Ji Hui",
"觀點": "Guan Dian",
"顯著的": "Xian Zhu De",
"排除": "Pai Chu",
"購物抵用金": "Gou Wu Di Yong Jin"
}
pinyin = pinyin_mapping.get(current_word["chinese"], current_word["chinese"])
pinyin_surface = font_large.render(pinyin, True, BLACK)
pinyin_rect = pinyin_surface.get_rect(center=(screen_width // 2, 220))
screen.blit(pinyin_surface, pinyin_rect)
else:
display_text("click_to_see", 220, font_small, GRAY)
# 繪製按鈕
for button in buttons:
button.draw()
# 顯示操作說明
display_text("instructions", 400, font_small, BLACK)
display_text("play_instruction", 440, font_small, BLACK)
display_text("nav_instruction", 480, font_small, BLACK)
display_text("auto_instruction", 520, font_small, BLACK)
pygame.display.flip()
clock.tick(30)
except Exception as e:
print(f"Error in main loop: {e}")
time.sleep(1)
# 執行程序
if __name__ == "__main__":
try:
main()
except Exception as e:
print(f"Program error: {e}")
finally:
try:
pygame.quit()
except:
pass
try:
# 正常退出
sys.exit()
except:
# 如果系統退出失敗,使用os._exit
try:
import os
os._exit(0)
except:
pass
Mastering TOEIC Skills (unit 11 / 12):
words = [
{"english": "administrator", "chinese": "管理員"},
{"english": "biotechnology", "chinese": "生物技術"},
{"english": "critical",
"chinese": "危急的;臨界的;關鍵的;批判的"},
{"english": "deductible", "chinese": "免賠額(名詞)"},
{"english": "deduct", "chinese": "扣除;減去"},
{"english": "deduce", "chinese": "推斷;推論"},
{"english": "reduce", "chinese": "減少;降低"},
{"english": "infer", "chinese": "推斷;推測"},
{"english": "implant", "chinese": "植入"},
{"english": "plant", "chinese": "植物;種植"},
{"english": "imply", "chinese": "暗示;意味著"},
{"english": "implement", "chinese": "實施;工具(動詞 名詞)"},
{"english": "medical malpractice", "chinese": "醫療事故"},
{"english": "medical tourism", "chinese": "醫療旅遊"},
{"english": "nutritious", "chinese": "有營養的"},
{"english": "patient-centered", "chinese": "以患者為中心的"},
{"english": "pharmaceutical representative", "chinese": "醫藥代表"},
{"english": "scheduler", "chinese": "安排人"},
{"english": "state-of-the-art", "chinese": "最先進的"},
{"english": "cutting-edge", "chinese": "尖端的、最前沿的"},
{"english": "leading-edge", "chinese": "領先的、最先進的"},
{"english": "bleeding-edge", "chinese": "極尖端的、最新穎的"},
{"english": "bleeding", "chinese": "流血的;極度的"},
{"english": "insure", "chinese": "投保、保險"},
{"english": "ensure", "chinese": "確保、保證"},
{"english": "assure", "chinese": "向...保證、使安心"},
{"english": "insurance", "chinese": "保險"},
{"english": "insured", "chinese": "已投保的、被保險人"},
{"english": "uninsured", "chinese": "未投保的、無保險的"},
{"english": "insurer", "chinese": "保險公司、承保人"},
{"english": "insurant", "chinese": "投保人、被保險人"},
{"english": "insurable", "chinese": "可保險的"},
{"english": "reinsure", "chinese": "再保險"},
{"english": "underinsured", "chinese": "保險不足的"},
{"english": "policy", "chinese": "保單、政策"},
{"english": "insurance policy", "chinese": "保險單"},
{"english": "utilize", "chinese": "利用"},
{"english": "utilization", "chinese": "利用;使用"},
{"english": "utility", "chinese": "效用;工具;公用事業"},
{"english": "nutrition", "chinese": "營養"},
{"english": "diet", "chinese": "飲食、節食"},
{"english": "dietitian", "chinese": "營養師"},
{"english": "dietician", "chinese": "營養師(另一種拼法)"},
{"english": "dietary", "chinese": "飲食的、膳食的"},
{"english": "dieter", "chinese": "節食者"},
{"english": "dieting", "chinese": "節食、減肥"},
{"english": "dietetics", "chinese": "營養學"},
{"english": "balanced diet", "chinese": "均衡飲食"},
{"english": "go on a diet", "chinese": "開始節食"},
{"english": "dietary fiber", "chinese": "膳食纖維"},
{"english": "dietary supplement", "chinese": "膳食補充劑"},
{"english": "low-fat diet", "chinese": "低脂飲食"},
{"english": "vegetarian diet", "chinese": "素食"},
{"english": "ketogenic diet", "chinese": "生酮飲食"},
{"english": "contaminated", "chinese": "受污染的"},
{"english": "contagious", "chinese": "傳染性的"},
{"english": "physician", "chinese": "醫生(通常指內科醫生)"},
{"english": "surgeon", "chinese": "外科醫生"},
{"english": "doctor", "chinese": "醫生(通稱)"},
{"english": "internist", "chinese": "內科醫生"},
{"english": "general practitioner (GP)", "chinese": "全科醫生、家庭醫生"},
{"english": "supplement", "chinese": "補充劑"},
{"english": "stethoscope", "chinese": "聽診器"},
{"english": "physiotherapist", "chinese": "物理治療師"},
{"english": "diagnosis", "chinese": "診斷(名詞)"},
{"english": "diagnose", "chinese": "診斷(動詞)"},
{"english": "diagnostic", "chinese": "診斷的(形容詞)"},
{"english": "diagnostics", "chinese": "診斷學、診斷方法"},
{"english": "diagnosed", "chinese": "被診斷的"},
{"english": "misdiagnose", "chinese": "誤診"},
{"english": "misdiagnosis", "chinese": "誤診(名詞)"},
{"english": "prognosis", "chinese": "預後、預測"},
{"english": "volunteer", "chinese": "志願者"},
{"english": "therapist", "chinese": "治療師"},
{"english": "hand sanitizer", "chinese": "洗手液"},
{"english": "skin test", "chinese": "皮膚測試"},
{"english": "medical devices", "chinese": "醫療設備"},
{"english": "abnormal", "chinese": "異常的"},
{"english": "norm", "chinese": "常規"},
{"english": "coherent", "chinese": "連貫的"},
{"english": "consequence", "chinese": "結果、後果"},
{"english": "sequence", "chinese": "順序、序列"},
{"english": "consequent", "chinese": "隨之而來的、結果的"},
{"english": "sequential", "chinese": "連續的、按順序的"},
{"english": "subsequently", "chinese": "隨後、後來"},
{"english": "consequently", "chinese": "因此、所以"},
{"english": "sequel", "chinese": "續集、續篇"},
{"english": "subsequent", "chinese": "隨後的、後續的"},
{"english": "inconsequential", "chinese": "無關緊要的"},
{"english": "in sequence", "chinese": "按順序"},
{"english": "out of sequence", "chinese": "順序錯亂"},
{"english": "courtesy", "chinese": "禮貌"},
{"english": "curiosity", "chinese": "好奇心"},
{"english": "designate", "chinese": "指定"},
{"english": "essential", "chinese": "必要的"},
{"english": "fad", "chinese": "一時的流行"},
{"english": "hesitant", "chinese": "猶豫的"},
{"english": "obligatory", "chinese": "必須的"},
{"english": "optimize", "chinese": "優化"},
{"english": "optimum", "chinese": "最優化的"},
{"english": "optimus", "chinese": "擎天柱"},
{"english": "requisite", "chinese": "必要的"},
{"english": "require", "chinese": "需要"},
{"english": "respect", "chinese": "尊重"},
{"english": "esteem", "chinese": "尊敬、敬重"},
{"english": "taboo", "chinese": "禁忌"},
{"english": "taco", "chinese": "墨西哥玉米餅"},
{"english": "unambiguous", "chinese": "清晰的"},
{"english": "convinced", "chinese": "被說服的、確信的"},
{"english": "convince", "chinese": "使確信、說服"},
{"english": "persuade", "chinese": "說服"},
{"english": "patience", "chinese": "耐心"},
{"english": "forbid", "chinese": "禁止"},
{"english": "congratulated", "chinese": "祝賀"},
{"english": "conscious", "chinese": "有意識的(形容詞)"},
{"english": "consciousness", "chinese": "意識、知覺(名詞)"},
{"english": "unconscious", "chinese": "無意識的、昏迷的"},
{"english": "unconsciousness", "chinese": "無意識、昏迷狀態"},
{"english": "subconscious", "chinese": "潛意識的"},
{"english": "subconsciousness", "chinese": "潛意識"},
{"english": "self-conscious", "chinese": "害羞的、不自在的"},
{"english": "self-consciousness", "chinese": "害羞、不自在"},
{"english": "conscience", "chinese": "良心"},
{"english": "conscientious", "chinese": "有良心的、盡責的、認真的"},
{"english": "conscienceless", "chinese": "沒良心的、無良心的"},
{"english": "unconscionable", "chinese": "沒良心的、不合理的"},
{"english": "irritate", "chinese": "惹惱"},
{"english": "correspondence", "chinese": "通信"},
{"english": "appreciation", "chinese": "感激"},
{"english": "interactive", "chinese": "互動的"},
{"english": "attentive", "chinese": "專心的、細心的、留心的"},
{"english": "attentive", "chinese": "專心的、細心的、留心的"},
{"english": "attend", "chinese": "出席、參加、照料、注意"},
{"english": "attention", "chinese": "注意、注意力、關注"},
{"english": "attendance", "chinese": "出席、出勤"},
{"english": "attendant", "chinese": "服務員、隨從"},
{"english": "attendee", "chinese": "出席者、參加者"},
{"english": "inattentive", "chinese": "不專心的"},
{"english": "inattention", "chinese": "不注意、疏忽"},
{"english": "unique", "chinese": "獨特的"},
{"english": "patient", "chinese": "病人、耐心的"},
{"english": "patience", "chinese": "耐心"},
{"english": "therapy", "chinese": "治療、療法"},
{"english": "therapist", "chinese": "治療師"},
{"english": "physics", "chinese": "物理學"},
{"english": "physicist", "chinese": "物理學家"},
{"english": "physiotherapist", "chinese": "物理治療師"},
{"english": "pharmacy", "chinese": "藥房、藥學"},
{"english": "pharmacist", "chinese": "藥劑師"},
{"english": "diagonal", "chinese": "對角線的"},
{"english": "diagnosis", "chinese": "診斷"},
{"english": "supplement", "chinese": "補充劑"},
{"english": "supplemental", "chinese": "補充的"},
{"english": "complementary", "chinese": "互補的"},
{"english": "supplement", "chinese": "補充劑、補充"},
{"english": "supple", "chinese": "柔軟的、柔韌的、靈活的"},
{"english": "supplementary", "chinese": "補充的、附加的"},
{"english": "supplemental", "chinese": "補充的、追加的"},
{"english": "suppleness", "chinese": "柔軟、柔韌性"},
{"english": "supply", "chinese": "供應、提供"},
{"english": "optimal", "chinese": "最佳的"},
{"english": "optimize", "chinese": "優化"},
{"english": "optimum", "chinese": "最優化的"},
{"english": "hesitate", "chinese": "猶豫"},
{"english": "hesitant", "chinese": "猶豫的"},
{"english": "hesitation", "chinese": "猶豫"},
{"english": "irritation", "chinese": "刺激、惱怒"},
{"english": "irritate", "chinese": "惹惱"},
{"english": "irrigation", "chinese": "灌溉"},
{"english": "appreciate", "chinese": "感激、欣賞"},
{"english": "appreciation", "chinese": "感激"},
{"english": "depreciate", "chinese": "貶值"},
{"english": "correspondent", "chinese": "通訊員、記者"},
{"english": "correspondence", "chinese": "通信"},
{"english": "corresponding", "chinese": "相應的"},
{"english": "enthusiastic", "chinese": "熱情的"},
{"english": "enthusiasm", "chinese": "熱情"},
{"english": "deficient", "chinese": "缺乏的"},
{"english": "deficiency", "chinese": "缺乏"},
{"english": "efficient", "chinese": "有效率的"},
{"english": "efficiency", "chinese": "效率"}
]
近期留言