刚开始学,程序有很多需要完善的地方,大家多指教。
import tkinter as tk
import win32com.client
import random
window = tk.Tk()
score = 0
count = 1
a = random.randint(1, 9)
b = random.randint(1, 9)
speaker = win32com.client.Dispatch("SAPI.SpVoice")
mul01 = tk.StringVar()
mul01.set(str(a))
mul02 = tk.StringVar()
mul02.set(str(b))
count_title = tk.StringVar()
count_title.set('第1道题')
score_lab = tk.StringVar()
score_lab.set('0')
gameover = tk.StringVar()
gameover.set("测试共20道乘法,每题5分,总分100分")
window.title("乘法口诀测试")
window.geometry('600x500')
window["background"] = "hotpink"
title01 = tk.Label(window,