大学课堂点名程序
from gtts import gTTS
import os
import tkinter as tk
import pygame
import csv
import random
from datetime import datetime
from tkinter import messagebox
from tkinter import simpledialog
input_data="student1"
def langDu(text):tts = gTTS(text, lang='zh-tw', slow=False)tts.save("output.mp3")pygame.mixer.init()pygame.mixer.music.load("output.mp3")pygame.mixer.music.play()while pygame.mixer.music.get_busy():pygame.time.Clock().tick(10)def update_student_name():global current_student_indexglobal shuffled_student_indicesif current_student_index < len(student_names):student_index = shuffled_student_indices[current_student_index]student_name_var.set(student_names[student_index])try:langDu(student_names[student_index])except:print(student_names[student_index], "未朗读"