源码
from tkinter import *
from tkinter import ttk
from tkinter import Menu
import random
from math import pi
root = Tk()
root.title("语言选择")
languages = ["中文", "英文", "俄文"]
language_var = StringVar()
language_combo = ttk.Combobox(root, textvariable=language_var, values=languages)
language_combo.grid(column=0, row=0)
language_combo.current(0)
def submit_language():
global selected_language
selected_language = language_var.get()
root.destroy()
submit_button = ttk.Button(root, text="确定", command=submit_language)
submit_button.grid(column=1, row=0)
root.mainloop()
if selected_language == "中文":
#计算题
def calculate(min_val1, max_val1, min_val2, max_val2):
num1 = round(random.uniform(min_val1, max_val1), 2)
num2 = round(random.uniform(min_val2, max_val2), 2)
num3 = num1
num4 = round(100 - num2, 2)
expr = str(num1)+'×'+str(num2)+'+'+str(num3)+'×'+str(num4)
return expr
#一元方程
def equation_one():
a = random.randint(-10, 10)
if a == 0:
a = random.randint(1, 10)
b = random.randint(-10, 10)
sign_a = '-' if a < 0 else ''
sign_b = '-' if b < 0 else '+'
if b == 0:
equation = f"{sign_a}{abs(a)}x = 0"
else:
equation = f"{sign_a}{abs(a)}x {sign_b} {abs(b)} = 0"
return equation
#二元方程
def equation_two():
a = random.randint(-10, 10)
if a == 0:
a = random.randint(1, 10)
b = random.randint(-10, 10)
if b == 0:
b = random.randint(1, 10)
c = random.randint(-10, 10)
sign_a = '-' if a < 0 else ''
sign_b = '-' if b < 0 else '+'
sign_c = '-' if c < 0 else '+'
equation = f"{sign_a}{abs(a)}x {sign_b} {abs(b)}y {sign_c} {abs(c)} = 0"
return equation
#二次方程
def equation_sd():
a = random.randint(-10, 10)
if a == 0:
a = random.randint(1, 10)
b = random.randint(-10, 10)
c = random.randint(-10, 10)
sign_a = '-' if a < 0 else ''
sign_b = '-' if b < 0 else '+'
sign_c = '-' if c < 0 else '+'
equation = f"{sign_a}{abs(a)}x² {sign_b} {abs(b)}x {sign_c} {abs(c)} = 0"
return equation
def topic():
global A_e, B_e, C_e, D_g, E_g,X_o, Y_o, X_t, Y_t, X_sd, Y_sd;
A_e = calculate(10, 100, 10, 100)
B_e = calculate(10, 100, 10, 100)
C_e = calculate(10, 100, 10, 100)
D_g = calculate(10, 100, 10, 130)
E_g = calculate(10, 100, 10, 130)
X_o = equation_one()
Y_o = equation_one()
X_t = equation_two()
Y_t = equation_two()
X_sd = equation_sd()
Y_sd = equation_sd()
def up_date():
date = topic()
label1.config(text = A_e, font = ("微软雅黑", 15))
label2.config(text = B_e, font = ("微软雅黑", 15))
label3.config(text = C_e, font = ("微软雅黑", 15))
label4.config(text = D_g, font = ("微软雅黑", 15))
label5.config(text = E_g, font = ("微软雅黑", 15))
label6.config(text = X_o, font = ("微软雅黑", 15))
label7.config(text = Y_o, font = ("微软雅黑", 15))
label8.config(text = X_t, font = ("微软雅黑", 15))
label9.config(text = Y_t, font = ("微软雅黑", 15))
label10.config(text = X_sd, font = ("微软雅黑", 15))
label11.config(text = Y_sd, font = ("微软雅黑", 15))
def butt():
label.destroy()
button.destroy()
button1 = Button(root, text='重新生成', width = 20, height = 1, command = butt)
button1.place(x = 0, y = 0)
timer = root.after(0, up_date)
def temperature():
#摄氏度转华氏度函数体
def SZH():
def btnClicked1():
cd1 = float(entryCd1.get())
label1.config(text = "%.3f°C = %.3f°F" % (cd1,cd1 * 1.8 + 32))
def close_VICE_SZH():
VICE1_root.destroy()
VICE1_root = Tk(className = '摄氏度°C转华氏度°F')
VICE1_root.geometry("350x300+0+0")
close_button_VICE_SZH = Button(VICE1_root,text = "返回主界面",height=1,width=15,fg = 'red',command = close_VICE_SZH)
label1 = Label(VICE1_root,text = "摄氏度°C转华氏度°F",height = 5,width = 350,fg = "blue")
entryCd1 = Entry(VICE1_root,text = "0")
btnCal = Button(VICE1_root,text = "转换",command = btnClicked1)
label1.pack()
entryCd1.pack()
btnCal.pack()
close_button_VICE_SZH.pack()
VICE1_root.mainloop()
#华氏度转摄氏度函数体
def HZS():
def btnClicked2():
cd2 = float(entryCd2.get())
label2.config(text = "%.3f°C = %.3f°F" % (cd2,(cd2 - 32)/1.8))
def close_VICE_HZS():
VICE2_root.destroy()
VICE2_root = Tk(className = '华氏度°F转摄氏度°C')
VICE2_root.geometry("350x300+0+0")
close_button_VICE_HZS = Button(VICE2_root,text = "返回主界面",height=1,width=15,fg = 'red',command = close_VICE_HZS)
label2 = Label(VICE2_root,text = "华氏度°F转摄氏度°C",height = 5,width = 350,fg = "blue")
entryCd2 = Entry(VICE2_root,text = "0")
btnCal2 = Button(VICE2_root,text = "转换",command = btnClicked2)
label2.pack()
entryCd2.pack()
btnCal2.pack()
close_button_VICE_HZS.pack()
VICE2_root.mainloop()
#热力学温度转摄氏度函数体
def KZS():
def btnClicked3():
cd3 = float(entryCd3.get())
label3.config(text = "%.3fK = %.3f°C" % (cd3,(cd3 - 273.15)))
def close_VICE_KZS():
VICE3_root.destroy()
VICE3_root = Tk(className = '热力学温度K转摄氏度°C')
VICE3_root.geometry("350x300+0+0")
close_button_VICE_KZS = Button(VICE3_root,text = "返回主界面",height=1,width=15,fg = 'red',command = close_VICE_KZS)
label3 = Label(VICE3_root,text = "热力学温度K转摄氏度°C",height = 5,width = 350,fg = "blue")
entryCd3 = Entry(VICE3_root,text = "0")
btnCal3 = Button(VICE3_root,text = "转换",command = btnClicked3)
label3.pack()
entryCd3.pack()
btnCal3.pack()
close_button_VICE_KZS.pack()
VICE3_root.mainloop()
#摄氏度转热力学温度函数体
def SZK():
def btnClicked4():
cd4 = float(entryCd4.get())
label4.config(text = "%.3f°C = %.3fK" % (cd4,(cd4 + 273.15)))
def close_VICE_SZK():
VICE4_root.destroy()
VICE4_root = Tk(className = '摄氏度°C转热力学温度K')
VICE4_root.geometry("350x300+0+0")
close_button_VICE_SZK = Button(VICE4_root,text = "返回主界面",height=1,width=15,fg = 'red',command = close_VICE_SZK)
label4 = Label(VICE4_root,text = "摄氏度°C转热力学温度K",height = 5,width = 350,fg = "blue")
entryCd4 = Entry(VICE4_root,text = "0")
btnCal4 = Button(VICE4_root,text = "转换",command = btnClicked4)
label4.pack()
entryCd4.pack()
btnCal4.pack()
close_button_VICE_SZK.pack()
VICE4_root.mainloop()
#热力学温度转华氏度函数体
def KZH():
def btnClicked5():
cd5 = float(entryCd5.get())
label5.config(text = "%.3fK = %.3f°F" % (cd5,((cd5-273.5)*1.8/5+32)))
def close_VICE_KZH():
VICE5_root.destroy()
VICE5_root = Tk(className = '热力学温度K转华氏度°F')
VICE5_root.geometry("350x300+0+0")
close_button_VICE_KZH = Button(VICE5_root,text = "返回主界面",height=1,width=15,fg = 'red',command = close_VICE_KZH)
label5 = Label(VICE5_root,text = "热力学温度K转华氏度°F",height = 5,width = 350,fg = "blue")
entryCd5 = Entry(VICE5_root,text = "0")
btnCal5 = Button(VICE5_root,text = "转换",command = btnClicked5)
label5.pack()
entryCd5.pack()
btnCal5.pack()
close_button_VICE_KZH.pack()
VICE5_root.mainloop()
#华氏度转热力学温度函数体
def HZK():
def btnClicked6():
cd6 = float(entryCd6.get())
label6.config(text = "%.3f°F = %.3fK" % (cd6,((cd6-32)*5/1.8+273.5)))
def close_VICE_HZK():
VICE6_root.destroy()
VICE6_root = Tk(className = '华氏度°F转热力学温度K')
VICE6_root.geometry("350x300+0+0")
close_button_VICE_HZK = Button(VICE6_root,text = "返回主界面",height=1,width=15,fg = 'red',command = close_VICE_HZK)
label6 = Label(VICE6_root,text = "华氏度°F转热力学温度K",height = 5,width = 350,fg = "blue")
entryCd6 = Entry(VICE6_root,text = "0")
btnCal6 = Button(VICE6_root,text = "转换",command = btnClicked6)
label6.pack()
entryCd6.pack()
btnCal6.pack()
close_button_VICE_HZK.pack()
VICE6_root.mainloop()
#主界面关闭函数体
def close_HOST():
root.destroy()
root = Tk(className = '温度互转仪')
root.geometry("350x350+100+100")
root.overrideredirect(True)
l = Label(root,text = "转换模式",height=2,width=20,fg="orange")
close_button_HOST = Button(root,text = "×",height=1,width=5,font=("微软雅黑",15),fg = 'black',bd=0,command = close_HOST)
button1 = Button(root,text = "摄氏度°C转华氏度°F",height=1,width=30,fg = 'red',command = SZH)
button2 = Button(root,text = "华氏度°F转摄氏度°C",height=1,width=30,fg = 'red',command = HZS)
button3 = Button(root,text = "热力学温度K转摄氏度°C",height=1,width=30,fg = 'red',command = KZS)
button4 = Button(root,text = "摄氏度°C转热力学温度K",height=1,width=30,fg = 'red',command = SZK)
button5 = Button(root,text = "热力学温度K转华氏度°F",height=1,width=30,fg = 'red',command = KZH)
button6 = Button(root,text = "华氏度°F转热力学温度K",height=1,width=30,fg = 'red',command = HZK)
close_button_HOST.place(x=300,y=0)
l.pack()
button1.pack()
button2.pack()
button3.pack()
button4.pack()
button5.pack()
button6.pack()
root.mainloop()
def Y():
window= Tk()
window.title('元素周期表')
window.geometry('930x890+100+100')
window.attributes("-alpha", 0.9)
window.resizable(False, False)
L = Label(window, text = '元素周期表',font=('微软雅黑',30))
#例
introduceelement1 = Label(window,text = '原子序数↘ ↙化学符号',font=('微软雅黑',7))
introduceelement1.place(x=200,y=40)
introduceelement2 = Label(window,text = ' 95 Am',font=('微软雅黑',10))
introduceelement2.place(x=200,y=60)
introduceelement3 = Label(window,text = ' 镅',font=('微软雅黑',20))
introduceelement3.place(x=150,y=80)
introduceelement4 = Label(window,text = '元素名称 ↗(243)↰',font=('微软雅黑',10))
introduceelement4.place(x=180,y=120)
introduceelement5 = Label(window,text = ' 相对原子质量',font=('微软雅黑',10))
introduceelement5.place(x=200,y=140)
#族
FamilyIA = Label(window,text = ' IA族',font=('微软雅黑',10), relief=GROOVE)
FamilyIA.place(x=10,y=40)
FamilyIIA = Label(window,text = 'IIA族',font=('微软雅黑',10), relief=GROOVE)
FamilyIIA.place(x=60,y=120)
FamilyIIIB = Label(window,text = 'IIIB族',font=('微软雅黑',10), relief=GROOVE)
FamilyIIIB.place(x=110,y=280)
FamilyIVB = Label(window,text = 'IVB族',font=('微软雅黑',10), relief=GROOVE)
FamilyIVB.place(x=170,y=280)
FamilyVB = Label(window,text = ' VB族',font=('微软雅黑',10), relief=GROOVE)
FamilyVB.place(x=230,y=280)
FamilyVIB = Label(window,text = 'VIB族',font=('微软雅黑',10), relief=GROOVE)
FamilyVIB.place(x=280,y=280)
FamilyVIIB = Label(window,text = 'VIIB族',font=('微软雅黑',10), relief=GROOVE)
FamilyVIIB.place(x=330,y=280)
FamilyIB = Label(window,text = ' IB族',font=('微软雅黑',10), relief=GROOVE)
FamilyIB.place(x=530,y=280)
FamilyIIB = Label(window,text = ' IIB族',font=('微软雅黑',10), relief=GROOVE)
FamilyIIB.place(x=580,y=280)
FamilyIIIA = Label(window,text = ' IIIA族',font=('微软雅黑',10), relief=GROOVE)
FamilyIIIA.place(x=630,y=120)
FamilyIVA = Label(window,text = ' IVA族',font=('微软雅黑',10), relief=GROOVE)
FamilyIVA.place(x=680,y=120)
FamilyVA = Label(window,text = ' VA族',font=('微软雅黑',10), relief=GROOVE)
FamilyVA.place(x=730,y=120)
FamilyVIA = Label(window,text = ' VIA族',font=('微软雅黑',10), relief=GROOVE)
FamilyVIA.place(x=780,y=120)
FamilyVIIA = Label(window,text = ' VIIA族',font=('微软雅黑',10), relief=GROOVE)
FamilyVIIA.place(x=830,y=120)
Family0 = Label(window,text = ' 0族',font=('微软雅黑',10), relief=GROOVE)
Family0.place(x=880,y=40)
FamilyVIII = Label(window,text = ' VIII族 ' ,font=('微软雅黑',10), relief=GROOVE)
FamilyVIII.place(x=380,y=280)
#一周
#氢
FH1 = Label(window, text = '1 H',font=('微软雅黑',10))
FH1.place(x=10,y=60)
Y1 = Label(window, text = '氢',font=('微软雅黑',20))
Y1.place(x=10,y=80)
XS1 = Label(window, text = '1.008',font=('微软雅黑',10))
XS1.place(x=10,y=120)
#氦
FH2 = Label(window, text = '2 He',font=('微软雅黑',10))
FH2.place(x=880,y=60)
Y2 = Label(window, text = '氦',font=('微软雅黑',20))
Y2.place(x=880,y=80)
XS2 = Label(window, text = '4.003',font=('微软雅黑',10))
XS2.place(x=880,y=120)
#二周
#锂
FH3 = Label(window, text = '3 Li',font=('微软雅黑',10))
FH3.place(x=10,y=140)
Y3 = Label(window, text = '锂',font=('微软雅黑',20))
Y3.place(x=10,y=160)
XS3 = Label(window, text = '6.941',font=('微软雅黑',10))
XS3.place(x=10,y=200)
#铍
FH4 = Label(window, text = '4 Be',font=('微软雅黑',10))
FH4.place(x=60,y=140)
Y4 = Label(window, text = '铍',font=('微软雅黑',20))
Y4.place(x=60,y=160)
XS4 = Label(window, text = '9.012',font=('微软雅黑',10))
XS4.place(x=60,y=200)
#硼
FH5 = Label(window, text = '5 B',font=('微软雅黑',10))
FH5.place(x=630,y=140)
Y5 = Label(window, text = '硼',font=('微软雅黑',20))
Y5.place(x=630,y=160)
XS5 = Label(window, text = '10.811',font=('微软雅黑',10))
XS5.place(x=630,y=200)
#碳
FH6 = Label(window, text = '6 C',font=('微软雅黑',10))
FH6.place(x=680,y=140)
Y6 = Label(window, text = '碳',font=('微软雅黑',20))
Y6.place(x=680,y=160)
XS6 = Label(window, text = '12.011',font=('微软雅黑',10))
XS6.place(x=680,y=200)
#氮
FH7 = Label(window, text = '7 N',font=('微软雅黑',10))
FH7.place(x=730,y=140)
Y7 = Label(window, text = '氮',font=('微软雅黑',20))
Y7.place(x=730,y=160)
XS7 = Label(window, text = '14.007',font=('微软雅黑',10))
XS7.place(x=730,y=200)
#氧
FH8 = Label(window, text = '8 O',font=('微软雅黑',10))
FH8.place(x=780,y=140)
Y8 = Label(window, text = '氧',font=('微软雅黑',20))
Y8.place(x=780,y=160)
XS8 = Label(window, text = '15.999',font=('微软雅黑',10))
XS8.place(x=780,y=200)
#氟
FH9 = Label(window, text = '9 F',font=('微软雅黑',10))
FH9.place(x=830,y=140)
Y9 = Label(window, text = '氟',font=('微软雅黑',20))
Y9.place(x=830,y=160)
XS9 = Label(window, text = '18.998',font=('微软雅黑',10))
XS9.place(x=830,y=200)
#氖
FH10 = Label(window, text = '10 Ne',font=('微软雅黑',10))
FH10.place(x=880,y=140)
Y10 = Label(window, text = '氖',font=('微软雅黑',20))
Y10.place(x=880,y=160)
XS10 = Label(window, text = '20.180',font=('微软雅黑',10))
XS10.place(x=880,y=200)
#三周
#钠
FH11 = Label(window, text = '11 Na',font=('微软雅黑',10))
FH11.place(x=10,y=220)
Y11 = Label(window, text = '钠',font=('微软雅黑',20))
Y11.place(x=10,y=240)
XS11 = Label(window, text = '22.990',font=('微软雅黑',10))
XS11.place(x=10,y=280)
#镁
FH12 = Label(window, text = '12 Mg',font=('微软雅黑',10))
FH12.place(x=60,y=220)
Y12 = Label(window, text = '镁',font=('微软雅黑',20))
Y12.place(x=60,y=240)
XS12 = Label(window, text = '24.305',font=('微软雅黑',10))
XS12.place(x=60,y=280)
#铝
FH13 = Label(window, text = '13 Al',font=('微软雅黑',10))
FH13.place(x=630,y=220)
Y13 = Label(window, text = '铝',font=('微软雅黑',20))
Y13.place(x=630,y=240)
XS13 = Label(window, text = '26.982',font=('微软雅黑',10))
XS13.place(x=630,y=280)
#硅
FH14 = Label(window, text = '14 Si',font=('微软雅黑',10))
FH14.place(x=680,y=220)
Y14 = Label(window, text = '硅',font=('微软雅黑',20))
Y14.place(x=680,y=240)
XS14 = Label(window, text = '28.086',font=('微软雅黑',10))
XS14.place(x=680,y=280)
#磷
FH15 = Label(window, text = '15 P',font=('微软雅黑',10))
FH15.place(x=730,y=220)
Y15 = Label(window, text = '磷',font=('微软雅黑',20))
Y15.place(x=730,y=240)
XS15 = Label(window, text = '30.973',font=('微软雅黑',10))
XS15.place(x=730,y=280)
#硫
FH16 = Label(window, text = '16 S',font=('微软雅黑',10))
FH16.place(x=780,y=220)
Y16 = Label(window, text = '硫',font=('微软雅黑',20))
Y16.place(x=780,y=240)
XS16 = Label(window, text = '32.065',font=('微软雅黑',10))
XS16.place(x=780,y=280)
#氯
FH17 = Label(window, text = '17 Cl',font=('微软雅黑',10))
FH17.place(x=830,y=220)
Y17 = Label(window, text = '氯',font=('微软雅黑',20))
Y17.place(x=830,y=240)
XS17 = Label(window, text = '35.453',font=('微软雅黑',10))
XS17.place(x=830,y=280)
#氩
FH18 = Label(window, text = '18 Ar',font=('微软雅黑',10))
FH18.place(x=880,y=220)
Y18 = Label(window, text = '氩',font=('微软雅黑',20))
Y18.place(x=880,y=240)
XS18 = Label(window, text = '39.948',font=('微软雅黑',10))
XS18.place(x=880,y=280)
#四周
#钾
FH19 = Label(window, text = '19 K',font=('微软雅黑',10))
FH19.place(x=10,y=300)
Y19 = Label(window, text = '钾',font=('微软雅黑',20))
Y19.place(x=10,y=320)
XS19 = Label(window, text = '39.098',font=('微软雅黑',10))
XS19.place(x=10,y=360)
#钙
FH20 = Label(window, text = '20 Ca',font=('微软雅黑',10))
FH20.place(x=60,y=300)
Y20 = Label(window, text = '钙',font=('微软雅黑',20))
Y20.place(x=60,y=320)
XS20 = Label(window, text = '40.078',font=('微软雅黑',10))
XS20.place(x=60,y=360)
#钪
FH21 = Label(window, text = '21 Sc',font=('微软雅黑',10))
FH21.place(x=110,y=300)
Y21 = Label(window, text = '钪',font=('微软雅黑',20))
Y21.place(x=110,y=320)
XS21 = Label(window, text = '44.956',font=('微软雅黑',10))
XS21.place(x=110,y=360)
#钛
FH22 = Label(window, text = '22 Ti',font=('微软雅黑',10))
FH22.place(x=170,y=300)
Y22 = Label(window, text = '钛',font=('微软雅黑',20))
Y22.place(x=170,y=320)
XS22 = Label(window, text = '47.867',font=('微软雅黑',10))
XS22.place(x=170,y=360)
#钒
FH23 = Label(window, text = '23 V',font=('微软雅黑',10))
FH23.place(x=230,y=300)
Y23 = Label(window, text = '钒',font=('微软雅黑',20))
Y23.place(x=230,y=320)
XS23 = Label(window, text = '50.941',font=('微软雅黑',10))
XS23.place(x=230,y=360)
#铬
FH24 = Label(window, text = '24 Cr',font=('微软雅黑',10))
FH24.place(x=280,y=300)
Y24 = Label(window, text = '铬',font=('微软雅黑',20))
Y24.place(x=280,y=320)
XS24 = Label(window, text = '51.996',font=('微软雅黑',10))
XS24.place(x=280,y=360)
#锰
FH25 = Label(window, text = '25 Mn',font=('微软雅黑',10))
FH25.place(x=330,y=300)
Y25 = Label(window, text = '锰',font=('微软雅黑',20))
Y25.place(x=330,y=320)
XS25 = Label(window, text = '54.940',font=('微软雅黑',10))
XS25.place(x=330,y=360)
#铁
FH26 = Label(window, text = '26 Fe',font=('微软雅黑',10))
FH26.place(x=380,y=300)
Y26 = Label(window, text = '铁',font=('微软雅黑',20))
Y26.place(x=380,y=320)
XS26 = Label(window, text = '55.945',font=('微软雅黑',10))
XS26.place(x=380,y=360)
#钴
FH27 = Label(window, text = '27 Co',font=('微软雅黑',10))
FH27.place(x=430,y=300)
Y27 = Label(window, text = '钴',font=('微软雅黑',20))
Y27.place(x=430,y=320)
XS27 = Label(window, text = '58.993',font=('微软雅黑',10))
XS27.place(x=430,y=360)
#镍
FH28 = Label(window, text = '28 Ni',font=('微软雅黑',10))
FH28.place(x=480,y=300)
Y28 = Label(window, text = '镍',font=('微软雅黑',20))
Y28.place(x=480,y=320)
XS28 = Label(window, text = '58.693',font=('微软雅黑',10))
XS28.place(x=480,y=360)
#铜
FH29 = Label(window, text = '29 Cu',font=('微软雅黑',10))
FH29.place(x=530,y=300)
Y29 = Label(window, text = '铜',font=('微软雅黑',20))
Y29.place(x=530,y=320)
XS29 = Label(window, text = '63.546',font=('微软雅黑',10))
XS29.place(x=530,y=360)
#锌
FH30 = Label(window, text = '30 Zn',font=('微软雅黑',10))
FH30.place(x=580,y=300)
Y30 = Label(window, text = '锌',font=('微软雅黑',20))
Y30.place(x=580,y=320)
XS30 = Label(window, text = '65.39',font=('微软雅黑',10))
XS30.place(x=580,y=360)
#镓
FH31 = Label(window, text = '31 Ga',font=('微软雅黑',10))
FH31.place(x=630,y=300)
Y31 = Label(window, text = '镓',font=('微软雅黑',20))
Y31.place(x=630,y=320)
XS31 = Label(window, text = '69.723',font=('微软雅黑',10))
XS31.place(x=630,y=360)
#锗
FH32 = Label(window, text = '32 Ge',font=('微软雅黑',10))
FH32.place(x=680,y=300)
Y32 = Label(window, text = '锗',font=('微软雅黑',20))
Y32.place(x=680,y=320)
XS32 = Label(window, text = '72.64',font=('微软雅黑',10))
XS32.place(x=680,y=360)
#砷
FH33 = Label(window, text = '33 As',font=('微软雅黑',10))
FH33.place(x=730,y=300)
Y33 = Label(window, text = '砷',font=('微软雅黑',20))
Y33.place(x=730,y=320)
XS33 = Label(window, text = '74.922',font=('微软雅黑',10))
XS33.place(x=730,y=360)
#硒
FH34 = Label(window, text = '34 Se',font=('微软雅黑',10))
FH34.place(x=780,y=300)
Y34 = Label(window, text = '硒',font=('微软雅黑',20))
Y34.place(x=780,y=320)
XS34 = Label(window, text = '78.96',font=('微软雅黑',10))
XS34.place(x=780,y=360)
#㴪
FH35 = Label(window, text = '35 Br',font=('微软雅黑',10))
FH35.place(x=830,y=300)
Y35 = Label(window, text = '㴪',font=('微软雅黑',20))
Y35.place(x=830,y=320)
XS35 = Label(window, text = '79.90',font=('微软雅黑',10))
XS35.place(x=830,y=360)
#氪
FH36 = Label(window, text = '36 Kr',font=('微软雅黑',10))
FH36.place(x=880,y=300)
Y36 = Label(window, text = '氪',font=('微软雅黑',20))
Y36.place(x=880,y=320)
XS36 = Label(window, text = '83.80',font=('微软雅黑',10))
XS36.place(x=880,y=360)
#五周
#铷
FH37 = Label(window, text = '37 Rb',font=('微软雅黑',10))
FH37.place(x=10,y=380)
Y37 = Label(window, text = '铷',font=('微软雅黑',20))
Y37.place(x=10,y=400)
XS37 = Label(window, text = '85.469',font=('微软雅黑',10))
XS37.place(x=10,y=440)
#锶
FH38 = Label(window, text = '38 Sr',font=('微软雅黑',10))
FH38.place(x=60,y=380)
Y38 = Label(window, text = '锶',font=('微软雅黑',20))
Y38.place(x=60,y=400)
XS38 = Label(window, text = '87.62',font=('微软雅黑',10))
XS38.place(x=60,y=440)
#钇
FH39 = Label(window, text = '39 Y',font=('微软雅黑',10))
FH39.place(x=110,y=380)
Y39 = Label(window, text = '钇',font=('微软雅黑',20))
Y39.place(x=110,y=400)
XS39 = Label(window, text = '88.906',font=('微软雅黑',10))
XS39.place(x=110,y=440)
#锆
FH40 = Label(window, text = '40 Zr',font=('微软雅黑',10))
FH40.place(x=170,y=380)
Y40 = Label(window, text = '锆',font=('微软雅黑',20))
Y40.place(x=170,y=400)
XS40 = Label(window, text = '91.224',font=('微软雅黑',10))
XS40.place(x=170,y=440)
#铌
FH41 = Label(window, text = '41 Nb',font=('微软雅黑',10))
FH41.place(x=230,y=380)
Y41 = Label(window, text = '铌',font=('微软雅黑',20))
Y41.place(x=230,y=400)
XS41 = Label(window, text = '92.906',font=('微软雅黑',10))
XS41.place(x=230,y=440)
#钼
FH42 = Label(window, text = '42 Mo',font=('微软雅黑',10))
FH42.place(x=280,y=380)
Y42 = Label(window, text = '钼',font=('微软雅黑',20))
Y42.place(x=280,y=400)
XS42 = Label(window, text = '95.94',font=('微软雅黑',10))
XS42.place(x=280,y=440)
#锝
FH43 = Label(window, text = '43 Tc',font=('微软雅黑',10))
FH43.place(x=330,y=380)
Y43 = Label(window, text = '锝',font=('微软雅黑',20))
Y43.place(x=330,y=400)
XS43 = Label(window, text = '98.906',font=('微软雅黑',10))
XS43.place(x=330,y=440)
#钌
FH44 = Label(window, text = '44 Ru',font=('微软雅黑',10))
FH44.place(x=380,y=380)
Y44 = Label(window, text = '钌',font=('微软雅黑',20))
Y44.place(x=380,y=400)
XS44 = Label(window, text = '101.07',font=('微软雅黑',10))
XS44.place(x=380,y=440)
#铑
FH45 = Label(window, text = '45 Rh',font=('微软雅黑',10))
FH45.place(x=430,y=380)
Y45 = Label(window, text = '铑',font=('微软雅黑',20))
Y45.place(x=430,y=400)
XS45 = Label(window, text = '102.91',font=('微软雅黑',10))
XS45.place(x=430,y=440)
#钯
FH46 = Label(window, text = '46 Pd',font=('微软雅黑',10))
FH46.place(x=480,y=380)
Y46 = Label(window, text = '钯',font=('微软雅黑',20))
Y46.place(x=480,y=400)
XS46 = Label(window, text = '106.42',font=('微软雅黑',10))
XS46.place(x=480,y=440)
#银
FH47 = Label(window, text = '47 Ag',font=('微软雅黑',10))
FH47.place(x=530,y=380)
Y47 = Label(window, text = '银',font=('微软雅黑',20))
Y47.place(x=530,y=400)
XS47 = Label(window, text = '107.868',font=('微软雅黑',10))
XS47.place(x=530,y=440)
#镉
FH48 = Label(window, text = '48 Cd',font=('微软雅黑',10))
FH48.place(x=580,y=380)
Y48 = Label(window, text = '镉',font=('微软雅黑',20))
Y48.place(x=580,y=400)
XS48 = Label(window, text = '112.411',font=('微软雅黑',10))
XS48.place(x=580,y=440)
#铟
FH49 = Label(window, text = '49 ln',font=('微软雅黑',10))
FH49.place(x=630,y=380)
Y49 = Label(window, text = '铟',font=('微软雅黑',20))
Y49.place(x=630,y=400)
XS49 = Label(window, text = '114.8',font=('微软雅黑',10))
XS49.place(x=630,y=440)
#锡
FH50 = Label(window, text = '50 Sn',font=('微软雅黑',10))
FH50.place(x=680,y=380)
Y50 = Label(window, text = '锡',font=('微软雅黑',20))
Y50.place(x=680,y=400)
XS50 = Label(window, text = '118.7',font=('微软雅黑',10))
XS50.place(x=680,y=440)
#锑
FH51 = Label(window, text = '51 Sb',font=('微软雅黑',10))
FH51.place(x=730,y=380)
Y51 = Label(window, text = '锑',font=('微软雅黑',20))
Y51.place(x=730,y=400)
XS51 = Label(window, text = '121.8',font=('微软雅黑',10))
XS51.place(x=730,y=440)
#碲
FH52 = Label(window, text = '52 Te',font=('微软雅黑',10))
FH52.place(x=780,y=380)
Y52 = Label(window, text = '碲',font=('微软雅黑',20))
Y52.place(x=780,y=400)
XS52 = Label(window, text = '127.6',font=('微软雅黑',10))
XS52.place(x=780,y=440)
#碘
FH53 = Label(window, text = '53 l',font=('微软雅黑',10))
FH53.place(x=830,y=380)
Y53 = Label(window, text = '碘',font=('微软雅黑',20))
Y53.place(x=830,y=400)
XS53 = Label(window, text = '126.9',font=('微软雅黑',10))
XS53.place(x=830,y=440)
#氙
FH54 = Label(window, text = '54 Xe',font=('微软雅黑',10))
FH54.place(x=880,y=380)
Y54 = Label(window, text = '氙',font=('微软雅黑',20))
Y54.place(x=880,y=400)
XS54 = Label(window, text = '131.3',font=('微软雅黑',10))
XS54.place(x=880,y=440)
#六周壹
#铯
FH55 = Label(window, text = '55 Cs',font=('微软雅黑',10))
FH55.place(x=10,y=460)
Y55 = Label(window, text = '铯',font=('微软雅黑',20))
Y55.place(x=10,y=480)
XS55 = Label(window, text = '132.9',font=('微软雅黑',10))
XS55.place(x=10,y=520)
#钡
FH56 = Label(window, text = '56 Ba',font=('微软雅黑',10))
FH56.place(x=60,y=460)
Y56 = Label(window, text = '钡',font=('微软雅黑',20))
Y56.place(x=60,y=480)
XS56 = Label(window, text = '137.3',font=('微软雅黑',10))
XS56.place(x=60,y=520)
#镧系
#镧系总标
LXFH1 = Label(window, text = '57~71',font=('微软雅黑',10))
LXFH1.place(x=110,y=460)
LXY1 = Label(window, text = 'La~Lu',font=('微软雅黑',13))
LXY1.place(x=110,y=490)
LXXS1 = Label(window, text = ' 镧系',font=('微软雅黑',10))
LXXS1.place(x=110,y=520)
#镧系标
LXB = Label(window, text = '镧\n系',font=('微软雅黑',15))
LXB.place(x=85,y=690)
#镧
FH57 = Label(window, text = '57 La',font=('微软雅黑',10))
FH57.place(x=110,y=680)
Y57 = Label(window, text = '镧',font=('微软雅黑',20))
Y57.place(x=110,y=700)
XS57 = Label(window, text = '138.9',font=('微软雅黑',10))
XS57.place(x=110,y=740)
#铈
FH58 = Label(window, text = '58 Ce',font=('微软雅黑',10))
FH58.place(x=170,y=680)
Y58 = Label(window, text = '铈',font=('微软雅黑',20))
Y58.place(x=170,y=700)
XS58 = Label(window, text = '140.1',font=('微软雅黑',10))
XS58.place(x=170,y=740)
#镨
FH59 = Label(window, text = '59 Pr',font=('微软雅黑',10))
FH59.place(x=230,y=680)
Y59 = Label(window, text = '镨',font=('微软雅黑',20))
Y59.place(x=230,y=700)
XS59 = Label(window, text = '140.9',font=('微软雅黑',10))
XS59.place(x=230,y=740)
#钕
FH60 = Label(window, text = '60 Nd',font=('微软雅黑',10))
FH60.place(x=280,y=680)
Y60 = Label(window, text = '钕',font=('微软雅黑',20))
Y60.place(x=280,y=700)
XS60 = Label(window, text = '144.2',font=('微软雅黑',10))
XS60.place(x=280,y=740)
#钷
FH61 = Label(window, text = '61 Pm',font=('微软雅黑',10))
FH61.place(x=330,y=680)
Y61 = Label(window, text = '钷',font=('微软雅黑',20))
Y61.place(x=330,y=700)
XS61 = Label(window, text = '(145)',font=('微软雅黑',10))
XS61.place(x=330,y=740)
#钐
FH62 = Label(window, text = '62 Sm',font=('微软雅黑',10))
FH62.place(x=380,y=680)
Y62 = Label(window, text = '钐',font=('微软雅黑',20))
Y62.place(x=380,y=700)
XS62 = Label(window, text = '150.4',font=('微软雅黑',10))
XS62.place(x=380,y=740)
#铕
FH63 = Label(window, text = '63 Eu',font=('微软雅黑',10))
FH63.place(x=430,y=680)
Y63 = Label(window, text = '铕',font=('微软雅黑',20))
Y63.place(x=430,y=700)
XS63 = Label(window, text = '152.0',font=('微软雅黑',10))
XS63.place(x=430,y=740)
#钆
FH64 = Label(window, text = '64 Cd',font=('微软雅黑',10))
FH64.place(x=480,y=680)
Y64 = Label(window, text = '钆',font=('微软雅黑',20))
Y64.place(x=480,y=700)
XS64 = Label(window, text = '112.411',font=('微软雅黑',10))
XS64.place(x=480,y=740)
#铽
FH65 = Label(window, text = '65 ln',font=('微软雅黑',10))
FH65.place(x=530,y=680)
Y65 = Label(window, text = '铽',font=('微软雅黑',20))
Y65.place(x=530,y=700)
XS65 = Label(window, text = '158.9',font=('微软雅黑',10))
XS65.place(x=530,y=740)
#镝
FH66 = Label(window, text = '66 Dy',font=('微软雅黑',10))
FH66.place(x=580,y=680)
Y66 = Label(window, text = '镝',font=('微软雅黑',20))
Y66.place(x=580,y=700)
XS66 = Label(window, text = '162.5',font=('微软雅黑',10))
XS66.place(x=580,y=740)
#钬
FH67 = Label(window, text = '67 Ho',font=('微软雅黑',10))
FH67.place(x=630,y=680)
Y67 = Label(window, text = '钬',font=('微软雅黑',20))
Y67.place(x=630,y=700)
XS67 = Label(window, text = '164.9',font=('微软雅黑',10))
XS67.place(x=630,y=740)
#铒
FH68 = Label(window, text = '68 Er',font=('微软雅黑',10))
FH68.place(x=680,y=680)
Y68 = Label(window, text = '铒',font=('微软雅黑',20))
Y68.place(x=680,y=700)
XS68 = Label(window, text = '167.3',font=('微软雅黑',10))
XS68.place(x=680,y=740)
#铥
FH69 = Label(window, text = '69 Tm',font=('微软雅黑',10))
FH69.place(x=730,y=680)
Y69 = Label(window, text = '铥',font=('微软雅黑',20))
Y69.place(x=730,y=700)
XS69 = Label(window, text = '168.9',font=('微软雅黑',10))
XS69.place(x=730,y=740)
#镱
FH70 = Label(window, text = '70 Xe',font=('微软雅黑',10))
FH70.place(x=780,y=680)
Y70 = Label(window, text = '镱',font=('微软雅黑',20))
Y70.place(x=780,y=700)
XS70 = Label(window, text = '173.0',font=('微软雅黑',10))
XS70.place(x=780,y=740)
#镥
FH71 = Label(window, text = '71 Xe',font=('微软雅黑',10))
FH71.place(x=830,y=680)
Y71 = Label(window, text = '镥',font=('微软雅黑',20))
Y71.place(x=830,y=700)
XS71 = Label(window, text = '175.0',font=('微软雅黑',10))
XS71.place(x=830,y=740)
#六周贰
#铪
FH72 = Label(window, text = '72 Hf',font=('微软雅黑',10))
FH72.place(x=170,y=460)
Y72 = Label(window, text = '铪',font=('微软雅黑',20))
Y72.place(x=170,y=480)
XS72 = Label(window, text = '178.5',font=('微软雅黑',10))
XS72.place(x=170,y=520)
#钽
FH73 = Label(window, text = '73 Ta',font=('微软雅黑',10))
FH73.place(x=230,y=460)
Y73 = Label(window, text = '钽',font=('微软雅黑',20))
Y73.place(x=230,y=480)
XS73 = Label(window, text = '180.9',font=('微软雅黑',10))
XS73.place(x=230,y=520)
#钨
FH74 = Label(window, text = '74 W',font=('微软雅黑',10))
FH74.place(x=280,y=460)
Y74 = Label(window, text = '钨',font=('微软雅黑',20))
Y74.place(x=280,y=480)
XS74 = Label(window, text = '183.8',font=('微软雅黑',10))
XS74.place(x=280,y=520)
#铼
FH75 = Label(window, text = '75 Re',font=('微软雅黑',10))
FH75.place(x=330,y=460)
Y75 = Label(window, text = '铼',font=('微软雅黑',20))
Y75.place(x=330,y=480)
XS75 = Label(window, text = '186.2',font=('微软雅黑',10))
XS75.place(x=330,y=520)
#锇
FH76 = Label(window, text = '76 Os',font=('微软雅黑',10))
FH76.place(x=380,y=460)
Y76 = Label(window, text = '锇',font=('微软雅黑',20))
Y76.place(x=380,y=480)
XS76 = Label(window, text = '190.2',font=('微软雅黑',10))
XS76.place(x=380,y=520)
#铱
FH77 = Label(window, text = '77 lr',font=('微软雅黑',10))
FH77.place(x=430,y=460)
Y77 = Label(window, text = '铱',font=('微软雅黑',20))
Y77.place(x=430,y=480)
XS77 = Label(window, text = '192.2',font=('微软雅黑',10))
XS77.place(x=430,y=520)
#铂
FH78 = Label(window, text = '78 Pt',font=('微软雅黑',10))
FH78.place(x=480,y=460)
Y78 = Label(window, text = '铂',font=('微软雅黑',20))
Y78.place(x=480,y=480)
XS78 = Label(window, text = '195.1',font=('微软雅黑',10))
XS78.place(x=480,y=520)
#金
FH79 = Label(window, text = '79 Au',font=('微软雅黑',10))
FH79.place(x=530,y=460)
Y79 = Label(window, text = '金',font=('微软雅黑',20))
Y79.place(x=530,y=480)
XS79 = Label(window, text = '197.0',font=('微软雅黑',10))
XS79.place(x=530,y=520)
#汞
FH80 = Label(window, text = '80 Hg',font=('微软雅黑',10))
FH80.place(x=580,y=460)
Y80 = Label(window, text = '汞',font=('微软雅黑',20))
Y80.place(x=580,y=480)
XS80 = Label(window, text = '200.6',font=('微软雅黑',10))
XS80.place(x=580,y=520)
#铊
FH81 = Label(window, text = '81 Hg',font=('微软雅黑',10))
FH81.place(x=630,y=460)
Y81 = Label(window, text = '铊',font=('微软雅黑',20))
Y81.place(x=630,y=480)
XS81 = Label(window, text = '204.4',font=('微软雅黑',10))
XS81.place(x=630,y=520)
#铅
FH82 = Label(window, text = '82 Pb',font=('微软雅黑',10))
FH82.place(x=680,y=460)
Y82 = Label(window, text = '铅',font=('微软雅黑',20))
Y82.place(x=680,y=480)
XS82 = Label(window, text = '207.2',font=('微软雅黑',10))
XS82.place(x=680,y=520)
#铋
FH83 = Label(window, text = '83 Bi',font=('微软雅黑',10))
FH83.place(x=730,y=460)
Y83 = Label(window, text = '铋',font=('微软雅黑',20))
Y83.place(x=730,y=480)
XS83 = Label(window, text = '209.0',font=('微软雅黑',10))
XS83.place(x=730,y=520)
#钋
FH84 = Label(window, text = '84 Pb',font=('微软雅黑',10))
FH84.place(x=780,y=460)
Y84 = Label(window, text = '钋',font=('微软雅黑',20))
Y84.place(x=780,y=480)
XS84 = Label(window, text = '(209)',font=('微软雅黑',10))
XS84.place(x=780,y=520)
#砹
FH85 = Label(window, text = '85 At',font=('微软雅黑',10))
FH85.place(x=830,y=460)
Y85 = Label(window, text = '砹',font=('微软雅黑',20))
Y85.place(x=830,y=480)
XS85 = Label(window, text = '(210)',font=('微软雅黑',10))
XS85.place(x=830,y=520)
#氡
FH86 = Label(window, text = '86 Rn',font=('微软雅黑',10))
FH86.place(x=880,y=460)
Y86 = Label(window, text = '氡',font=('微软雅黑',20))
Y86.place(x=880,y=480)
XS86 = Label(window, text = '(220)',font=('微软雅黑',10))
XS86.place(x=880,y=520)
#七周壹
#钫
FH87 = Label(window, text = '87 Fr',font=('微软雅黑',10))
FH87.place(x=10,y=540)
Y87 = Label(window, text = '钫',font=('微软雅黑',20))
Y87.place(x=10,y=560)
XS87 = Label(window, text = '(223)',font=('微软雅黑',10))
XS87.place(x=10,y=600)
#钡
FH88 = Label(window, text = '88 Ra',font=('微软雅黑',10))
FH88.place(x=60,y=540)
Y88 = Label(window, text = '镭',font=('微软雅黑',20))
Y88.place(x=60,y=560)
XS88 = Label(window, text = '(226)',font=('微软雅黑',10))
XS88.place(x=60,y=600)
#锕系
#锕系总标
AXFH1 = Label(window, text = '89~103',font=('微软雅黑',10))
AXFH1.place(x=110,y=540)
AXY1 = Label(window, text = 'Ac~Lr',font=('微软雅黑',13))
AXY1.place(x=110,y=570)
AXXS1 = Label(window, text = ' 锕系',font=('微软雅黑',10))
AXXS1.place(x=110,y=600)
#锕系标
AXB = Label(window, text = '锕\n系',font=('微软雅黑',15))
AXB.place(x=85,y=760)
#锕
FH89 = Label(window, text = '89 Ac',font=('微软雅黑',10))
FH89.place(x=110,y=760)
Y89 = Label(window, text = '锕',font=('微软雅黑',20))
Y89.place(x=110,y=780)
XS89 = Label(window, text = '(227)',font=('微软雅黑',10))
XS89.place(x=110,y=820)
#钍
FH90 = Label(window, text = '90 Th',font=('微软雅黑',10))
FH90.place(x=170,y=760)
Y90 = Label(window, text = '钍',font=('微软雅黑',20))
Y90.place(x=170,y=780)
XS90 = Label(window, text = '232.0',font=('微软雅黑',10))
XS90.place(x=170,y=820)
#镤
FH91 = Label(window, text = '91 Pa',font=('微软雅黑',10))
FH91.place(x=230,y=760)
Y91 = Label(window, text = '镤',font=('微软雅黑',20))
Y91.place(x=230,y=780)
XS91 = Label(window, text = '231.0',font=('微软雅黑',10))
XS91.place(x=230,y=820)
#铀
FH92 = Label(window, text = '92 U',font=('微软雅黑',10))
FH92.place(x=280,y=760)
Y92 = Label(window, text = '铀',font=('微软雅黑',20))
Y92.place(x=280,y=780)
XS92 = Label(window, text = '238.0',font=('微软雅黑',10))
XS92.place(x=280,y=820)
#镎
FH93 = Label(window, text = '93 Np',font=('微软雅黑',10))
FH93.place(x=330,y=760)
Y93 = Label(window, text = '镎',font=('微软雅黑',20))
Y93.place(x=330,y=780)
XS93 = Label(window, text = '(237)',font=('微软雅黑',10))
XS93.place(x=330,y=820)
#钚
FH94 = Label(window, text = '94 Pu',font=('微软雅黑',10))
FH94.place(x=380,y=760)
Y94 = Label(window, text = '钚',font=('微软雅黑',20))
Y94.place(x=380,y=780)
XS94 = Label(window, text = '(244)',font=('微软雅黑',10))
XS94.place(x=380,y=820)
#镅
FH95= Label(window, text = 'Am',font=('微软雅黑',10))
FH95.place(x=430,y=760)
Y95= Label(window, text = '镅',font=('微软雅黑',20))
Y95.place(x=430,y=780)
XS95= Label(window, text = '(243)',font=('微软雅黑',10))
XS95.place(x=430,y=820)
#锔
FH96 = Label(window, text = '96 Am',font=('微软雅黑',10))
FH96.place(x=480,y=760)
Y96 = Label(window, text = '锔',font=('微软雅黑',20))
Y96.place(x=480,y=780)
XS96 = Label(window, text = '(247)',font=('微软雅黑',10))
XS96.place(x=480,y=820)
#锫
FH97 = Label(window, text = '97 Bk',font=('微软雅黑',10))
FH97.place(x=530,y=760)
Y97 = Label(window, text = '锫',font=('微软雅黑',20))
Y97.place(x=530,y=780)
XS97 = Label(window, text = '(247)',font=('微软雅黑',10))
XS97.place(x=530,y=820)
#锎
FH98 = Label(window, text = '98 Cf',font=('微软雅黑',10))
FH98.place(x=580,y=760)
Y98 = Label(window, text = '锎',font=('微软雅黑',20))
Y98.place(x=580,y=780)
XS98 = Label(window, text = '(251)',font=('微软雅黑',10))
XS98.place(x=580,y=820)
#锿
FH99 = Label(window, text = '99 Es',font=('微软雅黑',10))
FH99.place(x=630,y=760)
Y99 = Label(window, text = '锿',font=('微软雅黑',20))
Y99.place(x=630,y=780)
XS99 = Label(window, text = '(252)',font=('微软雅黑',10))
XS99.place(x=630,y=820)
#镄
FH100 = Label(window, text = '100 Fm',font=('微软雅黑',10))
FH100.place(x=680,y=760)
Y100 = Label(window, text = '镄',font=('微软雅黑',20))
Y100.place(x=680,y=780)
XS100 = Label(window, text = '(257)',font=('微软雅黑',10))
XS100.place(x=680,y=820)
#钔
FH101 = Label(window, text = '101 Md',font=('微软雅黑',10))
FH101.place(x=730,y=760)
Y101 = Label(window, text = '钔',font=('微软雅黑',20))
Y101.place(x=730,y=780)
XS101 = Label(window, text = '(258)',font=('微软雅黑',10))
XS101.place(x=730,y=820)
#锘
FH102 = Label(window, text = '102 No',font=('微软雅黑',10))
FH102.place(x=780,y=760)
Y102 = Label(window, text = '锘',font=('微软雅黑',20))
Y102.place(x=780,y=780)
XS102 = Label(window, text = '(259)',font=('微软雅黑',10))
XS102.place(x=780,y=820)
#铹
FH103 = Label(window, text = '103 Lr',font=('微软雅黑',10))
FH103.place(x=830,y=760)
Y103 = Label(window, text = '铹',font=('微软雅黑',20))
Y103.place(x=830,y=780)
XS103 = Label(window, text = '(266)',font=('微软雅黑',10))
XS103.place(x=830,y=820)
#七周贰 540 560 600
#钅卢
FH104 = Label(window, text = '104 Rf',font=('微软雅黑',10))
FH104.place(x=170,y=540)
Y104 = Label(window, text = '钅卢',font=('微软雅黑',15))
Y104.place(x=170,y=560)
XS104 = Label(window, text = '(267)',font=('微软雅黑',10))
XS104.place(x=170,y=600)
#钅杜
FH105 = Label(window, text = '105 Db',font=('微软雅黑',10))
FH105.place(x=230,y=540)
Y105 = Label(window, text = '钅杜',font=('微软雅黑',15))
Y105.place(x=230,y=560)
XS105 = Label(window, text = '(268)',font=('微软雅黑',10))
XS105.place(x=230,y=600)
#钅喜
FH106 = Label(window, text = '106 Sg',font=('微软雅黑',10))
FH106.place(x=280,y=540)
Y106 = Label(window, text = '钅喜',font=('微软雅黑',15))
Y106.place(x=280,y=560)
XS106 = Label(window, text = '(269)',font=('微软雅黑',10))
XS106.place(x=280,y=600)
#钅波
FH107 = Label(window, text = '107 Bh',font=('微软雅黑',10))
FH107.place(x=330,y=540)
Y107 = Label(window, text = '钅波',font=('微软雅黑',15))
Y107.place(x=330,y=560)
XS107 = Label(window, text = '(270)',font=('微软雅黑',10))
XS107.place(x=330,y=600)
#钅黑
FH108 = Label(window, text = '108 Hs',font=('微软雅黑',10))
FH108.place(x=380,y=540)
Y108 = Label(window, text = '钅黑',font=('微软雅黑',15))
Y108.place(x=380,y=560)
XS108 = Label(window, text = '(269)',font=('微软雅黑',10))
XS108.place(x=380,y=600)
#钅麦
FH109 = Label(window, text = '109 Mt',font=('微软雅黑',10))
FH109.place(x=430,y=540)
Y109 = Label(window, text = '钅麦',font=('微软雅黑',15))
Y109.place(x=430,y=560)
XS109 = Label(window, text = '(278)',font=('微软雅黑',10))
XS109.place(x=430,y=600)
#钅达
FH110 = Label(window, text = '110 Ds',font=('微软雅黑',10))
FH110.place(x=480,y=540)
Y110 = Label(window, text = '钅达',font=('微软雅黑',15))
Y110.place(x=480,y=560)
XS110 = Label(window, text = '(281)',font=('微软雅黑',10))
XS110.place(x=480,y=600)
#钅仑
FH111 = Label(window, text = '111 Rg',font=('微软雅黑',10))
FH111.place(x=530,y=540)
Y111 = Label(window, text = '钅仑',font=('微软雅黑',15))
Y111.place(x=530,y=560)
XS111 = Label(window, text = '(282)',font=('微软雅黑',10))
XS111.place(x=530,y=600)
#钅哥
FH112 = Label(window, text = '112 Cn',font=('微软雅黑',10))
FH112.place(x=580,y=540)
Y112 = Label(window, text = '钅哥',font=('微软雅黑',15))
Y112.place(x=580,y=560)
XS112 = Label(window, text = '(285)',font=('微软雅黑',10))
XS112.place(x=580,y=600)
#钅尔
FH113 = Label(window, text = '113 Nh',font=('微软雅黑',10))
FH113.place(x=630,y=540)
Y113 = Label(window, text = '钅尔',font=('微软雅黑',15))
Y113.place(x=630,y=560)
XS113 = Label(window, text = '(286)',font=('微软雅黑',10))
XS113.place(x=630,y=600)
#钅夫
FH114 = Label(window, text = '114 Fl',font=('微软雅黑',10))
FH114.place(x=680,y=540)
Y114 = Label(window, text = '钅夫',font=('微软雅黑',15))
Y114.place(x=680,y=560)
XS114 = Label(window, text = '(289)',font=('微软雅黑',10))
XS114.place(x=680,y=600)
#钅莫
FH115 = Label(window, text = '115 Mc',font=('微软雅黑',10))
FH115.place(x=730,y=540)
Y115 = Label(window, text = '钅莫',font=('微软雅黑',15))
Y115.place(x=730,y=560)
XS115 = Label(window, text = '(289)',font=('微软雅黑',10))
XS115.place(x=730,y=600)
#钅立
FH116 = Label(window, text = '116 Lv',font=('微软雅黑',10))
FH116.place(x=780,y=540)
Y116 = Label(window, text = '钅立',font=('微软雅黑',15))
Y116.place(x=780,y=560)
XS116 = Label(window, text = '(293)',font=('微软雅黑',10))
XS116.place(x=780,y=600)
#石田
FH117 = Label(window, text = '117 Ts',font=('微软雅黑',10))
FH117.place(x=830,y=540)
Y117 = Label(window, text = '石田',font=('微软雅黑',15))
Y117.place(x=830,y=560)
XS117 = Label(window, text = '(294)',font=('微软雅黑',10))
XS117.place(x=830,y=600)
#奥气
FH118 = Label(window, text = '118 Og',font=('微软雅黑',10))
FH118.place(x=880,y=540)
Y118_1 = Label(window, text = 'Og*',font=('微软雅黑',15))
Y118_1.place(x=885,y=560)
XS118 = Label(window, text = '(220)',font=('微软雅黑',10))
XS118.place(x=880,y=600)
#*
x = Label(window, text = '注*118号元素ao无法显示',font=('微软雅黑',10))
x.place(x=0,y=0)
L.pack()
window.mainloop()
def V():
#正方体
def SZH():
def btnClicked1():
cd1 = float(entryCd1.get())
label1.config(text = "棱长为%.3f的正方体体积为%.3f" % (cd1 ,(cd1 * cd1 * cd1)))
def close_VICE_SZH():
VICE1_root.destroy()
VICE1_root = Tk(className = '正方体体积计算')
VICE1_root.geometry("350x300+0+0")
close_button_VICE_SZH = Button(VICE1_root,text = "↺返回",fg = 'red',bd=0,command = close_VICE_SZH)
label1 = Label(VICE1_root,text = "正方体体积计算",fg = "blue")
entryCd1 = Entry(VICE1_root,text = " ")
btnCal = Button(VICE1_root,text = "计算",command = btnClicked1)
label1.place(x = 0,y = 0)
entryCd1.place(x = 0,y = 30)
btnCal.place(x = 155,y = 25)
close_button_VICE_SZH.place(x = 295,y = 0)
VICE1_root.mainloop()
#长方体
def HZS():
def btnClicked2():
cd2_1 = float(entryCd2_1.get())
cd2_2 = float(entryCd2_2.get())
cd2_3 = float(entryCd2_3.get())
label2.config(text=" 长为%.3f;宽为%.3f;高为%.3f的长方体体积为%.3f" % (cd2_1, cd2_2, cd2_3, cd2_1 * cd2_2 * cd2_3))
def close_VICE_HZS():
VICE2_root.destroy()
VICE2_root = Tk(className='长方体体积计算')
VICE2_root.geometry("350x300+0+0")
close_button_VICE_HZS = Button(VICE2_root, text="↺返回", fg='red', bd=0, command=close_VICE_HZS)
label2 = Label(VICE2_root, text="长方体体积计算", fg="blue")
label2_1 = Label(VICE2_root, text="长", fg="blue")
label2_2 = Label(VICE2_root, text="宽", fg="blue")
label2_3 = Label(VICE2_root, text="高", fg="blue")
entryCd2_1 = Entry(VICE2_root)
entryCd2_2 = Entry(VICE2_root)
entryCd2_3 = Entry(VICE2_root)
btnCal2 = Button(VICE2_root, text="计算", command=btnClicked2)
label2.place(x=0, y=0)
label2_1.place(x=0, y=30)
label2_2.place(x=0, y=60)
label2_3.place(x=0, y=90)
entryCd2_1.place(x=30, y=30)
entryCd2_2.place(x=30, y=60)
entryCd2_3.place(x=30, y=90)
btnCal2.place(x=0, y=120)
close_button_VICE_HZS.place(x=295, y=0)
VICE2_root.mainloop()
# 圆柱体
def KZS():
def btnClicked():
r = float(entryR.get())
h = float(entryH.get())
labelResult.config(text=" 半径为%.3f;高为%.3f的圆柱体体积为%.3f" % (r, h, r * r * pi * h))
def close_VICE3_YuanTi():
VICE3_root.destroy()
VICE3_root = Tk(className='圆柱体体积计算')
VICE3_root.geometry("350x300+0+0")
close_button_VICE3_YuanTi = Button(VICE3_root, text="↺返回", fg='red', bd=0, command=close_VICE3_YuanTi)
labelResult = Label(VICE3_root, text="圆柱体体积计算", fg="blue")
labelR = Label(VICE3_root, text="半径", fg="blue")
labelH = Label(VICE3_root, text="高", fg="blue")
entryR = Entry(VICE3_root)
entryH = Entry(VICE3_root)
btnCalculate = Button(VICE3_root, text="计算", command=btnClicked)
labelResult.place(x=0, y=0)
labelR.place(x=0, y=30)
labelH.place(x=0, y=60)
entryR.place(x=30, y=30)
entryH.place(x=30, y=60)
btnCalculate.place(x=0, y=90)
close_button_VICE3_YuanTi.place(x=295, y=0)
VICE3_root.mainloop()
def SZK():
def btnClicked():
r = float(entryR.get())
h = float(entryH.get())
labelResult.config(text=" 半径为%.3f;高为%.3f的圆锥体体积为%.3f" % (r, h, (1/3) * pi * r * r * h))
def close_VICE4_YuanTi():
VICE4_root.destroy()
VICE4_root = Tk(className='圆锥体体积计算')
VICE4_root.geometry("350x300+0+0")
close_button_VICE4_YuanTi = Button(VICE4_root, text="↺返回", fg='red', bd=0, command=close_VICE4_YuanTi)
labelResult = Label(VICE4_root, text="圆锥体体积计算", fg="blue")
labelR = Label(VICE4_root, text="半径", fg="blue")
labelH = Label(VICE4_root, text="高", fg="blue")
entryR = Entry(VICE4_root)
entryH = Entry(VICE4_root)
btnCalculate = Button(VICE4_root, text="计算", command=btnClicked)
labelResult.place(x=0, y=0)
labelR.place(x=0, y=30)
labelH.place(x=0, y=60)
entryR.place(x=30, y=30)
entryH.place(x=30, y=60)
btnCalculate.place(x=0, y=90)
close_button_VICE4_YuanTi.place(x=295, y=0)
VICE4_root.mainloop()
def KZH():
def btnClicked():
r1 = float(entryR1.get())
r2 = float(entryR2.get())
labelResult.config(text=" 外半径为%.3f;内半径为%.3f的圆环体体积为%.3f" % (r1, r2, pi * (r1**2 - r2**2) * r1))
def close_VICE5_YuanHuanTi():
VICE5_root.destroy()
VICE5_root = Tk(className='圆环体体积计算')
VICE5_root.geometry("350x300+0+0")
close_button_VICE5_YuanHuanTi = Button(VICE5_root, text="↺返回", fg='red', bd=0, command=close_VICE5_YuanHuanTi)
labelResult = Label(VICE5_root, text="圆环体体积计算", fg="blue")
labelR1 = Label(VICE5_root, text="外半径", fg="blue")
labelR2 = Label(VICE5_root, text="内半径", fg="blue")
entryR1 = Entry(VICE5_root)
entryR2 = Entry(VICE5_root)
btnCalculate = Button(VICE5_root, text="计算", command=btnClicked)
labelResult.place(x=0, y=0)
labelR1.place(x=0, y=30)
labelR2.place(x=0, y=60)
entryR1.place(x=40, y=30)
entryR2.place(x=40, y=60)
btnCalculate.place(x=0, y=90)
close_button_VICE5_YuanHuanTi.place(x=295, y=0)
VICE5_root.mainloop()
def HZK():
def btnClicked():
r = float(entryR.get())
labelResult.config(text=" 半径为%.3f的球体体积为%.3f" % (r, 4/3 * 3.141592653589793 * r**3))
def close_VICE6_QiuTi():
VICE6_root.destroy()
VICE6_root = Tk(className='球体体积计算')
VICE6_root.geometry("350x300+0+0")
close_button_VICE6_QiuTi = Button(VICE6_root, text="↺返回", fg='red', bd=0, command=close_VICE6_QiuTi)
labelResult = Label(VICE6_root, text="球体体积计算", fg="blue")
labelR = Label(VICE6_root, text="半径", fg="blue")
entryR = Entry(VICE6_root)
btnCalculate = Button(VICE6_root, text="计算", command=btnClicked)
labelResult.place(x=0, y=0)
labelR.place(x=0, y=30)
entryR.place(x=30, y=30)
btnCalculate.place(x=0, y=60)
close_button_VICE6_QiuTi.place(x=295, y=0)
VICE6_root.mainloop()
#主界面关闭函数体
def close_HOST():
root.destroy()
root = Tk(className = '温度互转仪')
root.geometry("350x350+100+100")
root.overrideredirect(True)
l = Label(root,text = "规则图形",height=2,width=20,fg="orange")
close_button_HOST = Button(root,text = "×",height=1,width=5,font=("微软雅黑",15),fg = 'black',bd=0,command = close_HOST)
button1 = Button(root,text = "正方体",height=1,width=30,fg = 'red',command = SZH)
button2 = Button(root,text = "长方体",height=1,width=30,fg = 'red',command = HZS)
button3 = Button(root,text = "圆柱",height=1,width=30,fg = 'red',command = KZS)
button4 = Button(root,text = "圆锥",height=1,width=30,fg = 'red',command = SZK)
button5 = Button(root,text = "圆环体",height=1,width=30,fg = 'red',command = KZH)
button6 = Button(root,text = "球体",height=1,width=30,fg = 'red',command = HZK)
close_button_HOST.place(x=300,y=0)
l.pack()
button1.pack()
button2.pack()
button3.pack()
button4.pack()
button5.pack()
button6.pack()
root.mainloop()
root = Tk()
root.title(" 题目生成器 V9.0")
root.geometry("500x500+100+100")
date = topic()
label1 = Label(root, text=' ', font = ("微软雅黑", 15))
label1.place(x = 0, y = 30)
label2 = Label(root, text=' ', font = ("微软雅黑", 15))
label2.place(x = 0, y = 60)
label3 = Label(root, text=' ', font = ("微软雅黑", 15))
label3.place(x = 0, y = 90)
label4 = Label(root, text=' ', font = ("微软雅黑", 15))
label4.place(x = 0, y = 120)
label5 = Label(root, text=' ', font = ("微软雅黑", 15))
label5.place(x = 0, y = 150)
label6 = Label(root, text=' ', font = ("微软雅黑", 15))
label6.place(x = 0, y = 210)
label7 = Label(root, text=' ', font = ("微软雅黑", 15))
label7.place(x = 0, y = 240)
label8 = Label(root, text=' ', font = ("微软雅黑", 15))
label8.place(x = 0, y = 300)
label9 = Label(root, text=' ', font = ("微软雅黑", 15))
label9.place(x = 0, y = 330)
label10 = Label(root, text=' ', font = ("微软雅黑", 15))
label10.place(x = 0, y = 390)
label11 = Label(root, text=' ', font = ("微软雅黑", 15))
label11.place(x = 0, y = 420)
label = Label(root, text='欢迎使用题目生成器!', font = ('微软雅黑', 20))
button = Button(root, text='生成题目', font = ('微软雅黑', 15), command = butt)
menu = Menu(root)
file_menu = Menu(menu, tearoff=0)
temperature_menu = Menu(menu, tearoff=0)
file_menu.add_command(label="重新生成", command=butt)
temperature_menu.add_command(label="温度互转仪", command=temperature)
temperature_menu.add_command(label="化学元素周期表", command=Y)
temperature_menu.add_command(label="体积计算器",command=V)
menu.add_cascade(label="文件", menu=file_menu)
menu.add_cascade(label="更多", menu=temperature_menu)
label.place(x = 120, y = 150)
button.place(x = 190, y = 200)
root.config(menu=menu)
root.mainloop()
elif selected_language == "英文":
def calculate(min_val1, max_val1, min_val2, max_val2):
num1 = round(random.uniform(min_val1, max_val1), 2)
num2 = round(random.uniform(min_val2, max_val2), 2)
num3 = num1
num4 = round(100 - num2, 2)
expr = str(num1)+'×'+str(num2)+'+'+str(num3)+'×'+str(num4)
return expr
#一元方程
def equation_one():
a = random.randint(-10, 10)
if a == 0:
a = random.randint(1, 10)
b = random.randint(-10, 10)
sign_a = '-' if a < 0 else ''
sign_b = '-' if b < 0 else '+'
if b == 0:
equation = f"{sign_a}{abs(a)}x = 0"
else:
equation = f"{sign_a}{abs(a)}x {sign_b} {abs(b)} = 0"
return equation
#二元方程
def equation_two():
a = random.randint(-10, 10)
if a == 0:
a = random.randint(1, 10)
b = random.randint(-10, 10)
if b == 0:
b = random.randint(1, 10)
c = random.randint(-10, 10)
sign_a = '-' if a < 0 else ''
sign_b = '-' if b < 0 else '+'
sign_c = '-' if c < 0 else '+'
equation = f"{sign_a}{abs(a)}x {sign_b} {abs(b)}y {sign_c} {abs(c)} = 0"
return equation
#二次方程
def equation_sd():
a = random.randint(-10, 10)
if a == 0:
a = random.randint(1, 10)
b = random.randint(-10, 10)
c = random.randint(-10, 10)
sign_a = '-' if a < 0 else ''
sign_b = '-' if b < 0 else '+'
sign_c = '-' if c < 0 else '+'
equation = f"{sign_a}{abs(a)}x² {sign_b} {abs(b)}x {sign_c} {abs(c)} = 0"
return equation
def topic():
global A_e, B_e, C_e, D_g, E_g,X_o, Y_o, X_t, Y_t, X_sd, Y_sd;
A_e = calculate(10, 100, 10, 100)
B_e = calculate(10, 100, 10, 100)
C_e = calculate(10, 100, 10, 100)
D_g = calculate(10, 100, 10, 130)
E_g = calculate(10, 100, 10, 130)
X_o = equation_one()
Y_o = equation_one()
X_t = equation_two()
Y_t = equation_two()
X_sd = equation_sd()
Y_sd = equation_sd()
def up_date():
date = topic()
label1.config(text = A_e, font = ("微软雅黑", 15))
label2.config(text = B_e, font = ("微软雅黑", 15))
label3.config(text = C_e, font = ("微软雅黑", 15))
label4.config(text = D_g, font = ("微软雅黑", 15))
label5.config(text = E_g, font = ("微软雅黑", 15))
label6.config(text = X_o, font = ("微软雅黑", 15))
label7.config(text = Y_o, font = ("微软雅黑", 15))
label8.config(text = X_t, font = ("微软雅黑", 15))
label9.config(text = Y_t, font = ("微软雅黑", 15))
label10.config(text = X_sd, font = ("微软雅黑", 15))
label11.config(text = Y_sd, font = ("微软雅黑", 15))
def butt():
label.destroy()
button.destroy()
button1 = Button(root, text='Regenerate', width = 20, height = 1, command = butt)
button1.place(x = 0, y = 0)
timer = root.after(0, up_date)
def temperature():
#摄氏度转华氏度函数体
def SZH():
def btnClicked1():
cd1 = float(entryCd1.get())
label1.config(text = "%.3f°C = %.3f°F" % (cd1,cd1 * 1.8 + 32))
def close_VICE_SZH():
VICE1_root.destroy()
VICE1_root = Tk(className = 'Celsius °C to Fahrenheit °F')
VICE1_root.geometry("350x300+0+0")
close_button_VICE_SZH = Button(VICE1_root,text = "Return to main interface",height=1,width=15,fg = 'red',command = close_VICE_SZH)
label1 = Label(VICE1_root,text = "Celsius °C to Fahrenheit °F",height = 5,width = 350,fg = "blue")
entryCd1 = Entry(VICE1_root,text = "0")
btnCal = Button(VICE1_root,text = "Convert",command = btnClicked1)
label1.pack()
entryCd1.pack()
btnCal.pack()
close_button_VICE_SZH.pack()
VICE1_root.mainloop()
#华氏度转摄氏度函数体
def HZS():
def btnClicked2():
cd2 = float(entryCd2.get())
label2.config(text = "%.3f°C = %.3f°F" % (cd2,(cd2 - 32)/1.8))
def close_VICE_HZS():
VICE2_root.destroy()
VICE2_root = Tk(className = 'Fahrenheit °F to Celsius °C')
VICE2_root.geometry("350x300+0+0")
close_button_VICE_HZS = Button(VICE2_root,text = "Return to main interface",height=1,width=15,fg = 'red',command = close_VICE_HZS)
label2 = Label(VICE2_root,text = "Fahrenheit °F to Celsius °C",height = 5,width = 350,fg = "blue")
entryCd2 = Entry(VICE2_root,text = "0")
btnCal2 = Button(VICE2_root,text = "Convert",command = btnClicked2)
label2.pack()
entryCd2.pack()
btnCal2.pack()
close_button_VICE_HZS.pack()
VICE2_root.mainloop()
#热力学温度转摄氏度函数体
def KZS():
def btnClicked3():
cd3 = float(entryCd3.get())
label3.config(text = "%.3fK = %.3f°C" % (cd3,(cd3 - 273.15)))
def close_VICE_KZS():
VICE3_root.destroy()
VICE3_root = Tk(className = 'Thermodynamic temperature K to Celsius °C')
VICE3_root.geometry("350x300+0+0")
close_button_VICE_KZS = Button(VICE3_root,text = "Return to main interface",height=1,width=15,fg = 'red',command = close_VICE_KZS)
label3 = Label(VICE3_root,text = "Thermodynamic temperature K to Celsius °C",height = 5,width = 350,fg = "blue")
entryCd3 = Entry(VICE3_root,text = "0")
btnCal3 = Button(VICE3_root,text = "Convert",command = btnClicked3)
label3.pack()
entryCd3.pack()
btnCal3.pack()
close_button_VICE_KZS.pack()
VICE3_root.mainloop()
#摄氏度转热力学温度函数体
def SZK():
def btnClicked4():
cd4 = float(entryCd4.get())
label4.config(text = "%.3f°C = %.3fK" % (cd4,(cd4 + 273.15)))
def close_VICE_SZK():
VICE4_root.destroy()
VICE4_root = Tk(className = 'Celsius °C to thermodynamic temperature K')
VICE4_root.geometry("350x300+0+0")
close_button_VICE_SZK = Button(VICE4_root,text = "Return to main interface",height=1,width=15,fg = 'red',command = close_VICE_SZK)
label4 = Label(VICE4_root,text = "Celsius °C to thermodynamic temperature K",height = 5,width = 350,fg = "blue")
entryCd4 = Entry(VICE4_root,text = "0")
btnCal4 = Button(VICE4_root,text = "Convert",command = btnClicked4)
label4.pack()
entryCd4.pack()
btnCal4.pack()
close_button_VICE_SZK.pack()
VICE4_root.mainloop()
#热力学温度转华氏度函数体
def KZH():
def btnClicked5():
cd5 = float(entryCd5.get())
label5.config(text = "%.3fK = %.3f°F" % (cd5,((cd5-273.5)*1.8/5+32)))
def close_VICE_KZH():
VICE5_root.destroy()
VICE5_root = Tk(className = 'Thermodynamic temperature K to Fahrenheit °F')
VICE5_root.geometry("350x300+0+0")
close_button_VICE_KZH = Button(VICE5_root,text = "Return to main interface",height=1,width=15,fg = 'red',command = close_VICE_KZH)
label5 = Label(VICE5_root,text = "Thermodynamic temperature K to Fahrenheit °F",height = 5,width = 350,fg = "blue")
entryCd5 = Entry(VICE5_root,text = "0")
btnCal5 = Button(VICE5_root,text = "Convert",command = btnClicked5)
label5.pack()
entryCd5.pack()
btnCal5.pack()
close_button_VICE_KZH.pack()
VICE5_root.mainloop()
#华氏度转热力学温度函数体
def HZK():
def btnClicked6():
cd6 = float(entryCd6.get())
label6.config(text = "%.3f°F = %.3fK" % (cd6,((cd6-32)*5/1.8+273.5)))
def close_VICE_HZK():
VICE6_root.destroy()
VICE6_root = Tk(className = 'Fahrenheit °F to thermodynamic temperature K')
VICE6_root.geometry("350x300+0+0")
close_button_VICE_HZK = Button(VICE6_root,text = "Return to main interface",height=1,width=15,fg = 'red',command = close_VICE_HZK)
label6 = Label(VICE6_root,text = "Fahrenheit °F to thermodynamic temperature K",height = 5,width = 350,fg = "blue")
entryCd6 = Entry(VICE6_root,text = "0")
btnCal6 = Button(VICE6_root,text = "Convert",command = btnClicked6)
label6.pack()
entryCd6.pack()
btnCal6.pack()
close_button_VICE_HZK.pack()
VICE6_root.mainloop()
#主界面关闭函数体
def close_HOST():
root.destroy()
root = Tk(className = 'temperature converter')
root.geometry("350x350+100+100")
root.overrideredirect(True)
l = Label(root,text = "conversion mode",height=2,width=20,fg="orange")
close_button_HOST = Button(root,text = "×",height=1,width=5,font=("微软雅黑",15),fg = 'black',bd=0,command = close_HOST)
button1 = Button(root,text = "Celsius °C to Fahrenheit °F",height=1,width=60,fg = 'red',command = SZH)
button2 = Button(root,text = "Fahrenheit °F to Celsius °C",height=1,width=60,fg = 'red',command = HZS)
button3 = Button(root,text = "Thermodynamic temperature K to Celsius °C",height=1,width=60,fg = 'red',command = KZS)
button4 = Button(root,text = "Celsius °C to thermodynamic temperature K",height=1,width=60,fg = 'red',command = SZK)
button5 = Button(root,text = "Thermodynamic temperature K to Fahrenheit °F",height=1,width=60,fg = 'red',command = KZH)
button6 = Button(root,text = "Fahrenheit °F to thermodynamic temperature K",height=1,width=60,fg = 'red',command = HZK)
close_button_HOST.place(x=300,y=0)
l.pack()
button1.pack()
button2.pack()
button3.pack()
button4.pack()
button5.pack()
button6.pack()
root.mainloop()
def V():
#正方体
def SZH():
def btnClicked1():
cd1 = float(entryCd1.get())
label1.config(text = "The volume of a cube with edge length %.3f is %.3f" % (cd1 ,(cd1 * cd1 * cd1)))
def close_VICE_SZH():
VICE1_root.destroy()
VICE1_root = Tk(className = 'cube volume calculation')
VICE1_root.geometry("350x300+0+0")
close_button_VICE_SZH = Button(VICE1_root,text = "↺return",fg = 'red',bd=0,command = close_VICE_SZH)
label1 = Label(VICE1_root,text = "cube volume calculation",fg = "blue")
entryCd1 = Entry(VICE1_root,text = " ")
btnCal = Button(VICE1_root,text = "calculate",command = btnClicked1)
label1.place(x = 0,y = 0)
entryCd1.place(x = 0,y = 30)
btnCal.place(x = 155,y = 25)
close_button_VICE_SZH.place(x = 295,y = 0)
VICE1_root.mainloop()
#长方体
def HZS():
def btnClicked2():
cd2_1 = float(entryCd2_1.get())
cd2_2 = float(entryCd2_2.get())
cd2_3 = float(entryCd2_3.get())
label2.config(text=" The volume of a cuboid with a length of %.3f, a width of %.3f, and a height of %.3f is %.3f." % (cd2_1, cd2_2, cd2_3, cd2_1 * cd2_2 * cd2_3))
def close_VICE_HZS():
VICE2_root.destroy()
VICE2_root = Tk(className='Cuboid volume calculation')
VICE2_root.geometry("350x300+0+0")
close_button_VICE_HZS = Button(VICE2_root, text="↺return", fg='red', bd=0, command=close_VICE_HZS)
label2 = Label(VICE2_root, text="Cuboid volume calculation", fg="blue")
label2_1 = Label(VICE2_root, text="length", fg="blue")
label2_2 = Label(VICE2_root, text="width", fg="blue")
label2_3 = Label(VICE2_root, text="height", fg="blue")
entryCd2_1 = Entry(VICE2_root)
entryCd2_2 = Entry(VICE2_root)
entryCd2_3 = Entry(VICE2_root)
btnCal2 = Button(VICE2_root, text="calculate", command=btnClicked2)
label2.place(x=0, y=0)
label2_1.place(x=0, y=30)
label2_2.place(x=0, y=60)
label2_3.place(x=0, y=90)
entryCd2_1.place(x=30, y=30)
entryCd2_2.place(x=30, y=60)
entryCd2_3.place(x=30, y=90)
btnCal2.place(x=0, y=120)
close_button_VICE_HZS.place(x=295, y=0)
VICE2_root.mainloop()
# 圆柱体
def KZS():
def btnClicked():
r = float(entryR.get())
h = float(entryH.get())
labelResult.config(text=" The volume of a cylinder with radius %.3f and height %.3f is %.3f" % (r, h, r * r * pi * h))
def close_VICE3_YuanTi():
VICE3_root.destroy()
VICE3_root = Tk(className='Cylinder volume calculation')
VICE3_root.geometry("350x300+0+0")
close_button_VICE3_YuanTi = Button(VICE3_root, text="↺return", fg='red', bd=0, command=close_VICE3_YuanTi)
labelResult = Label(VICE3_root, text="Cylinder volume calculation", fg="blue")
labelR = Label(VICE3_root, text="radius", fg="blue")
labelH = Label(VICE3_root, text="high", fg="blue")
entryR = Entry(VICE3_root)
entryH = Entry(VICE3_root)
btnCalculate = Button(VICE3_root, text="calculate", command=btnClicked)
labelResult.place(x=0, y=0)
labelR.place(x=0, y=30)
labelH.place(x=0, y=60)
entryR.place(x=30, y=30)
entryH.place(x=30, y=60)
btnCalculate.place(x=0, y=90)
close_button_VICE3_YuanTi.place(x=295, y=0)
VICE3_root.mainloop()
def SZK():
def btnClicked():
r = float(entryR.get())
h = float(entryH.get())
labelResult.config(text=" The radius of a cone is %.3f; the volume of a cone with height %.3f is %.3f" % (r, h, (1/3) * pi * r * r * h))
def close_VICE4_YuanTi():
VICE4_root.destroy()
VICE4_root = Tk(className='Cone volume calculation')
VICE4_root.geometry("350x300+0+0")
close_button_VICE4_YuanTi = Button(VICE4_root, text="↺return", fg='red', bd=0, command=close_VICE4_YuanTi)
labelResult = Label(VICE4_root, text="Cone volume calculation", fg="blue")
labelR = Label(VICE4_root, text="radius", fg="blue")
labelH = Label(VICE4_root, text="high", fg="blue")
entryR = Entry(VICE4_root)
entryH = Entry(VICE4_root)
btnCalculate = Button(VICE4_root, text="calculate", command=btnClicked)
labelResult.place(x=0, y=0)
labelR.place(x=0, y=30)
labelH.place(x=0, y=60)
entryR.place(x=30, y=30)
entryH.place(x=30, y=60)
btnCalculate.place(x=0, y=90)
close_button_VICE4_YuanTi.place(x=295, y=0)
VICE4_root.mainloop()
def KZH():
def btnClicked():
r1 = float(entryR1.get())
r2 = float(entryR2.get())
labelResult.config(text=" The outer radius is %.3f; the volume of the torus with inner radius %.3f is %.3f" % (r1, r2, pi * (r1**2 - r2**2) * r1))
def close_VICE5_YuanHuanTi():
VICE5_root.destroy()
VICE5_root = Tk(className='Torus volume calculation')
VICE5_root.geometry("350x300+0+0")
close_button_VICE5_YuanHuanTi = Button(VICE5_root, text="↺return", fg='red', bd=0, command=close_VICE5_YuanHuanTi)
labelResult = Label(VICE5_root, text="Torus volume calculation", fg="blue")
labelR1 = Label(VICE5_root, text="outer radius", fg="blue")
labelR2 = Label(VICE5_root, text="inner radius", fg="blue")
entryR1 = Entry(VICE5_root)
entryR2 = Entry(VICE5_root)
btnCalculate = Button(VICE5_root, text="calculate", command=btnClicked)
labelResult.place(x=0, y=0)
labelR1.place(x=0, y=30)
labelR2.place(x=0, y=60)
entryR1.place(x=40, y=30)
entryR2.place(x=40, y=60)
btnCalculate.place(x=0, y=90)
close_button_VICE5_YuanHuanTi.place(x=295, y=0)
VICE5_root.mainloop()
def HZK():
def btnClicked():
r = float(entryR.get())
labelResult.config(text="The volume of a sphere with radius %.3f is %.3f" % (r, 4/3 * pi * r**3))
def close_VICE6_QiuTi():
VICE6_root.destroy()
VICE6_root = Tk(className='Sphere volume calculation')
VICE6_root.geometry("350x300+0+0")
close_button_VICE6_QiuTi = Button(VICE6_root, text="↺return", fg='red', bd=0, command=close_VICE6_QiuTi)
labelResult = Label(VICE6_root, text="Sphere volume calculation", fg="blue")
labelR = Label(VICE6_root, text="radius", fg="blue")
entryR = Entry(VICE6_root)
btnCalculate = Button(VICE6_root, text="calculate", command=btnClicked)
labelResult.place(x=0, y=0)
labelR.place(x=0, y=30)
entryR.place(x=30, y=30)
btnCalculate.place(x=0, y=60)
close_button_VICE6_QiuTi.place(x=295, y=0)
VICE6_root.mainloop()
#主界面关闭函数体
def close_HOST():
root.destroy()
root = Tk(className = 'Volume calculator')
root.geometry("350x350+100+100")
root.overrideredirect(True)
l = Label(root,text = "regular graphics",height=2,width=20,fg="orange")
close_button_HOST = Button(root,text = "×",height=1,width=5,font=("微软雅黑",15),fg = 'black',bd=0,command = close_HOST)
button1 = Button(root,text = "cube",height=1,width=30,fg = 'red',command = SZH)
button2 = Button(root,text = "cuboid",height=1,width=30,fg = 'red',command = HZS)
button3 = Button(root,text = "cylinder",height=1,width=30,fg = 'red',command = KZS)
button4 = Button(root,text = "cone",height=1,width=30,fg = 'red',command = SZK)
button5 = Button(root,text = "torus",height=1,width=30,fg = 'red',command = KZH)
button6 = Button(root,text = "sphere",height=1,width=30,fg = 'red',command = HZK)
close_button_HOST.place(x=300,y=0)
l.pack()
button1.pack()
button2.pack()
button3.pack()
button4.pack()
button5.pack()
button6.pack()
root.mainloop()
root = Tk()
root.title("Question Generator V10.5")
root.geometry("500x500+100+100")
date = topic()
label1 = Label(root, text=' ', font = ("微软雅黑", 15))
label1.place(x = 0, y = 30)
label2 = Label(root, text=' ', font = ("微软雅黑", 15))
label2.place(x = 0, y = 60)
label3 = Label(root, text=' ', font = ("微软雅黑", 15))
label3.place(x = 0, y = 90)
label4 = Label(root, text=' ', font = ("微软雅黑", 15))
label4.place(x = 0, y = 120)
label5 = Label(root, text=' ', font = ("微软雅黑", 15))
label5.place(x = 0, y = 150)
label6 = Label(root, text=' ', font = ("微软雅黑", 15))
label6.place(x = 0, y = 210)
label7 = Label(root, text=' ', font = ("微软雅黑", 15))
label7.place(x = 0, y = 240)
label8 = Label(root, text=' ', font = ("微软雅黑", 15))
label8.place(x = 0, y = 300)
label9 = Label(root, text=' ', font = ("微软雅黑", 15))
label9.place(x = 0, y = 330)
label10 = Label(root, text=' ', font = ("微软雅黑", 15))
label10.place(x = 0, y = 390)
label11 = Label(root, text=' ', font = ("微软雅黑", 15))
label11.place(x = 0, y = 420)
label = Label(root, text='Welcome to the question generator!', font = ('微软雅黑', 20))
button = Button(root, text='Generate questions', font = ('微软雅黑', 15), command = butt)
menu = Menu(root)
file_menu = Menu(menu, tearoff=0)
temperature_menu = Menu(menu, tearoff=0)
file_menu.add_command(label="Regenerate", command=butt)
temperature_menu.add_command(label="temperature converter", command=temperature)
temperature_menu.add_command(label="Volume calculator",command=V)
menu.add_cascade(label="document", menu=file_menu)
menu.add_cascade(label="More", menu=temperature_menu)
label.place(x = 15, y = 150)
button.place(x = 140, y = 200)
root.config(menu=menu)
root.mainloop()
else :
#计算题
def calculate(min_val1, max_val1, min_val2, max_val2):
num1 = round(random.uniform(min_val1, max_val1), 2)
num2 = round(random.uniform(min_val2, max_val2), 2)
num3 = num1
num4 = round(100 - num2, 2)
expr = str(num1)+'×'+str(num2)+'+'+str(num3)+'×'+str(num4)
return expr
#一元方程
def equation_one():
a = random.randint(-10, 10)
if a == 0:
a = random.randint(1, 10)
b = random.randint(-10, 10)
sign_a = '-' if a < 0 else ''
sign_b = '-' if b < 0 else '+'
if b == 0:
equation = f"{sign_a}{abs(a)}x = 0"
else:
equation = f"{sign_a}{abs(a)}x {sign_b} {abs(b)} = 0"
return equation
#二元方程
def equation_two():
a = random.randint(-10, 10)
if a == 0:
a = random.randint(1, 10)
b = random.randint(-10, 10)
if b == 0:
b = random.randint(1, 10)
c = random.randint(-10, 10)
sign_a = '-' if a < 0 else ''
sign_b = '-' if b < 0 else '+'
sign_c = '-' if c < 0 else '+'
equation = f"{sign_a}{abs(a)}x {sign_b} {abs(b)}y {sign_c} {abs(c)} = 0"
return equation
#二次方程
def equation_sd():
a = random.randint(-10, 10)
if a == 0:
a = random.randint(1, 10)
b = random.randint(-10, 10)
c = random.randint(-10, 10)
sign_a = '-' if a < 0 else ''
sign_b = '-' if b < 0 else '+'
sign_c = '-' if c < 0 else '+'
equation = f"{sign_a}{abs(a)}x² {sign_b} {abs(b)}x {sign_c} {abs(c)} = 0"
return equation
def topic():
global A_e, B_e, C_e, D_g, E_g,X_o, Y_o, X_t, Y_t, X_sd, Y_sd;
A_e = calculate(10, 100, 10, 100)
B_e = calculate(10, 100, 10, 100)
C_e = calculate(10, 100, 10, 100)
D_g = calculate(10, 100, 10, 130)
E_g = calculate(10, 100, 10, 130)
X_o = equation_one()
Y_o = equation_one()
X_t = equation_two()
Y_t = equation_two()
X_sd = equation_sd()
Y_sd = equation_sd()
def up_date():
date = topic()
label1.config(text = A_e, font = ("微软雅黑", 15))
label2.config(text = B_e, font = ("微软雅黑", 15))
label3.config(text = C_e, font = ("微软雅黑", 15))
label4.config(text = D_g, font = ("微软雅黑", 15))
label5.config(text = E_g, font = ("微软雅黑", 15))
label6.config(text = X_o, font = ("微软雅黑", 15))
label7.config(text = Y_o, font = ("微软雅黑", 15))
label8.config(text = X_t, font = ("微软雅黑", 15))
label9.config(text = Y_t, font = ("微软雅黑", 15))
label10.config(text = X_sd, font = ("微软雅黑", 15))
label11.config(text = Y_sd, font = ("微软雅黑", 15))
def butt():
label.destroy()
button.destroy()
button1 = Button(root, text='Восстановление', width = 20, height = 1, command = butt)
button1.place(x = 0, y = 0)
timer = root.after(0, up_date)
def temperature():
#摄氏度转华氏度函数体
def SZH():
def btnClicked1():
cd1 = float(entryCd1.get())
label1.config(text = "%.3f°C = %.3f°F" % (cd1,cd1 * 1.8 + 32))
def close_VICE_SZH():
VICE1_root.destroy()
VICE1_root = Tk(className = 'градус C по Фаренгейту')
VICE1_root.geometry("350x300+0+0")
close_button_VICE_SZH = Button(VICE1_root,text = "Вернуться к главному интерфейсу",height=1,width=50,fg = 'red',command = close_VICE_SZH)
label1 = Label(VICE1_root,text = "градус C по Фаренгейту",height = 5,width = 350,fg = "blue")
entryCd1 = Entry(VICE1_root,text = "0")
btnCal = Button(VICE1_root,text = "Преобразование",command = btnClicked1)
label1.pack()
entryCd1.pack()
btnCal.pack()
close_button_VICE_SZH.pack()
VICE1_root.mainloop()
#华氏度转摄氏度函数体
def HZS():
def btnClicked2():
cd2 = float(entryCd2.get())
label2.config(text = "%.3f°C = %.3f°F" % (cd2,(cd2 - 32)/1.8))
def close_VICE_HZS():
VICE2_root.destroy()
VICE2_root = Tk(className = 'градус F по Фаренгейту')
VICE2_root.geometry("350x300+0+0")
close_button_VICE_HZS = Button(VICE2_root,text = "Вернуться к главному интерфейсу",height=1,width=15,fg = 'red',command = close_VICE_HZS)
label2 = Label(VICE2_root,text = "градус F по Фаренгейту",height = 5,width = 350,fg = "blue")
entryCd2 = Entry(VICE2_root,text = "0")
btnCal2 = Button(VICE2_root,text = "Преобразование",command = btnClicked2)
label2.pack()
entryCd2.pack()
btnCal2.pack()
close_button_VICE_HZS.pack()
VICE2_root.mainloop()
#热力学温度转摄氏度函数体
def KZS():
def btnClicked3():
cd3 = float(entryCd3.get())
label3.config(text = "%.3fK = %.3f°C" % (cd3,(cd3 - 273.15)))
def close_VICE_KZS():
VICE3_root.destroy()
VICE3_root = Tk(className = 'Термодинамическая температура К - градус Цельсия')
VICE3_root.geometry("350x300+0+0")
close_button_VICE_KZS = Button(VICE3_root,text = "Вернуться к главному интерфейсу",height=1,width=15,fg = 'red',command = close_VICE_KZS)
label3 = Label(VICE3_root,text = "Термодинамическая температура К - градус Цельсия",height = 5,width = 350,fg = "blue")
entryCd3 = Entry(VICE3_root,text = "0")
btnCal3 = Button(VICE3_root,text = "Преобразование",command = btnClicked3)
label3.pack()
entryCd3.pack()
btnCal3.pack()
close_button_VICE_KZS.pack()
VICE3_root.mainloop()
#摄氏度转热力学温度函数体
def SZK():
def btnClicked4():
cd4 = float(entryCd4.get())
label4.config(text = "%.3f°C = %.3fK" % (cd4,(cd4 + 273.15)))
def close_VICE_SZK():
VICE4_root.destroy()
VICE4_root = Tk(className = 'Температура вращения при температуре C')
VICE4_root.geometry("350x300+0+0")
close_button_VICE_SZK = Button(VICE4_root,text = "Вернуться к главному интерфейсу",height=1,width=15,fg = 'red',command = close_VICE_SZK)
label4 = Label(VICE4_root,text = "Температура вращения при температуре C",height = 5,width = 350,fg = "blue")
entryCd4 = Entry(VICE4_root,text = "0")
btnCal4 = Button(VICE4_root,text = "Преобразование",command = btnClicked4)
label4.pack()
entryCd4.pack()
btnCal4.pack()
close_button_VICE_SZK.pack()
VICE4_root.mainloop()
#热力学温度转华氏度函数体
def KZH():
def btnClicked5():
cd5 = float(entryCd5.get())
label5.config(text = "%.3fK = %.3f°F" % (cd5,((cd5-273.5)*1.8/5+32)))
def close_VICE_KZH():
VICE5_root.destroy()
VICE5_root = Tk(className = 'Термодинамическая температура К - градус Фаренгейта')
VICE5_root.geometry("350x300+0+0")
close_button_VICE_KZH = Button(VICE5_root,text = "Вернуться к главному интерфейсу",height=1,width=15,fg = 'red',command = close_VICE_KZH)
label5 = Label(VICE5_root,text = "Термодинамическая температура К - градус Фаренгейта",height = 5,width = 350,fg = "blue")
entryCd5 = Entry(VICE5_root,text = "0")
btnCal5 = Button(VICE5_root,text = "Преобразование",command = btnClicked5)
label5.pack()
entryCd5.pack()
btnCal5.pack()
close_button_VICE_KZH.pack()
VICE5_root.mainloop()
#华氏度转热力学温度函数体
def HZK():
def btnClicked6():
cd6 = float(entryCd6.get())
label6.config(text = "%.3f°F = %.3fK" % (cd6,((cd6-32)*5/1.8+273.5)))
def close_VICE_HZK():
VICE6_root.destroy()
VICE6_root = Tk(className = 'градус F по Фаренгейту')
VICE6_root.geometry("350x300+0+0")
close_button_VICE_HZK = Button(VICE6_root,text = "Вернуться к главному интерфейсу",height=1,width=15,fg = 'red',command = close_VICE_HZK)
label6 = Label(VICE6_root,text = "градус F по Фаренгейту",height = 5,width = 350,fg = "blue")
entryCd6 = Entry(VICE6_root,text = "0")
btnCal6 = Button(VICE6_root,text = "Преобразование",command = btnClicked6)
label6.pack()
entryCd6.pack()
btnCal6.pack()
close_button_VICE_HZK.pack()
VICE6_root.mainloop()
#主界面关闭函数体
def close_HOST():
root.destroy()
root = Tk(className = 'температурный интервертор')
root.geometry("350x350+100+100")
root.overrideredirect(True)
l = Label(root,text = "Режим преобразования",height=2,width=20,fg="orange")
close_button_HOST = Button(root,text = "×",height=1,width=5,font=("微软雅黑",15),fg = 'black',bd=0,command = close_HOST)
button1 = Button(root,text = "градус C по Фаренгейту",height=1,width=60,fg = 'red',command = SZH)
button2 = Button(root,text = "градус F по Фаренгейту",height=1,width=60,fg = 'red',command = HZS)
button3 = Button(root,text = "Термодинамическая температура К - градус Цельсия",height=1,width=60,fg = 'red',command = KZS)
button4 = Button(root,text = "Температура вращения при температуре C",height=1,width=60,fg = 'red',command = SZK)
button5 = Button(root,text = "Термодинамическая температура К - градус Фаренгейта",height=1,width=60,fg = 'red',command = KZH)
button6 = Button(root,text = "градус F по Фаренгейту",height=1,width=60,fg = 'red',command = HZK)
close_button_HOST.place(x=300,y=0)
l.pack()
button1.pack()
button2.pack()
button3.pack()
button4.pack()
button5.pack()
button6.pack()
root.mainloop()
def V():
#正方体
def SZH():
def btnClicked1():
cd1 = float(entryCd1.get())
label1.config(text = "Размер квадрата с призмой% .3f" % (cd1 ,(cd1 * cd1 * cd1)))
def close_VICE_SZH():
VICE1_root.destroy()
VICE1_root = Tk(className = 'вычисление объёма квадрата')
VICE1_root.geometry("350x300+0+0")
close_button_VICE_SZH = Button(VICE1_root,text = "↺Возвращение",fg = 'red',bd=0,command = close_VICE_SZH)
label1 = Label(VICE1_root,text = "вычисление объёма квадрата",fg = "blue")
entryCd1 = Entry(VICE1_root,text = " ")
btnCal = Button(VICE1_root,text = "Расчет",command = btnClicked1)
label1.place(x = 0,y = 0)
entryCd1.place(x = 0,y = 30)
btnCal.place(x = 155,y = 25)
close_button_VICE_SZH.place(x = 295,y = 0)
VICE1_root.mainloop()
#长方体
def HZS():
def btnClicked2():
cd2_1 = float(entryCd2_1.get())
cd2_2 = float(entryCd2_2.get())
cd2_3 = float(entryCd2_3.get())
label2.config(text="Длина%.3f; Ширина%.3f; Длинный квадрат высотой%.3f %.3f" % (cd2_1, cd2_2, cd2_3, cd2_1 * cd2_2 * cd2_3))
def close_VICE_HZS():
VICE2_root.destroy()
VICE2_root = Tk(className='вычисление объёма прямоугольного тела')
VICE2_root.geometry("350x300+0+0")
close_button_VICE_HZS = Button(VICE2_root, text="↺Возвращение", fg='red', bd=0, command=close_VICE_HZS)
label2 = Label(VICE2_root, text="вычисление объёма прямоугольного тела", fg="blue")
label2_1 = Label(VICE2_root, text="Длинный", fg="blue")
label2_2 = Label(VICE2_root, text="Б", fg="blue")
label2_3 = Label(VICE2_root, text="Высокий", fg="blue")
entryCd2_1 = Entry(VICE2_root)
entryCd2_2 = Entry(VICE2_root)
entryCd2_3 = Entry(VICE2_root)
btnCal2 = Button(VICE2_root, text="Расчет", command=btnClicked2)
label2.place(x=0, y=0)
label2_1.place(x=0, y=30)
label2_2.place(x=0, y=60)
label2_3.place(x=0, y=90)
entryCd2_1.place(x=30, y=30)
entryCd2_2.place(x=30, y=60)
entryCd2_3.place(x=30, y=90)
btnCal2.place(x=0, y=120)
close_button_VICE_HZS.place(x=295, y=0)
VICE2_root.mainloop()
# 圆柱体
def KZS():
def btnClicked():
r = float(entryR.get())
h = float(entryH.get())
labelResult.config(text="Радиус%.3f; цилиндр высотой%.3f" % (r, h, r * r * pi * h))
def close_VICE3_YuanTi():
VICE3_root.destroy()
VICE3_root = Tk(className='вычисление объёма цилиндра')
VICE3_root.geometry("350x300+0+0")
close_button_VICE3_YuanTi = Button(VICE3_root, text="↺Возвращение", fg='red', bd=0, command=close_VICE3_YuanTi)
labelResult = Label(VICE3_root, text="вычисление объёма цилиндра", fg="blue")
labelR = Label(VICE3_root, text="Радиус", fg="blue")
labelH = Label(VICE3_root, text="Высокий", fg="blue")
entryR = Entry(VICE3_root)
entryH = Entry(VICE3_root)
btnCalculate = Button(VICE3_root, text="Расчет", command=btnClicked)
labelResult.place(x=0, y=0)
labelR.place(x=0, y=30)
labelH.place(x=0, y=60)
entryR.place(x=30, y=30)
entryH.place(x=30, y=60)
btnCalculate.place(x=0, y=90)
close_button_VICE3_YuanTi.place(x=295, y=0)
VICE3_root.mainloop()
def SZK():
def btnClicked():
r = float(entryR.get())
h = float(entryH.get())
labelResult.config(text="Радиус%.3f; Конус высотой%.3f имеет объем%.3f" % (r, h, (1/3) * pi * r * r * h))
def close_VICE4_YuanTi():
VICE4_root.destroy()
VICE4_root = Tk(className='вычисление объема конуса')
VICE4_root.geometry("350x300+0+0")
close_button_VICE4_YuanTi = Button(VICE4_root, text="↺Возвращение", fg='red', bd=0, command=close_VICE4_YuanTi)
labelResult = Label(VICE4_root, text="вычисление объема конуса", fg="blue")
labelR = Label(VICE4_root, text="Радиус", fg="blue")
labelH = Label(VICE4_root, text="Высокий", fg="blue")
entryR = Entry(VICE4_root)
entryH = Entry(VICE4_root)
btnCalculate = Button(VICE4_root, text="Расчет", command=btnClicked)
labelResult.place(x=0, y=0)
labelR.place(x=0, y=30)
labelH.place(x=0, y=60)
entryR.place(x=30, y=30)
entryH.place(x=30, y=60)
btnCalculate.place(x=0, y=90)
close_button_VICE4_YuanTi.place(x=295, y=0)
VICE4_root.mainloop()
def KZH():
def btnClicked():
r1 = float(entryR1.get())
r2 = float(entryR2.get())
labelResult.config(text="Внешний радиус%.3f; Размер кольца с внутренним радиусом%.3f" % (r1, r2, pi * (r1**2 - r2**2) * r1))
def close_VICE5_YuanHuanTi():
VICE5_root.destroy()
VICE5_root = Tk(className='вычисление объёма кольца')
VICE5_root.geometry("350x300+0+0")
close_button_VICE5_YuanHuanTi = Button(VICE5_root, text="↺Возвращение", fg='red', bd=0, command=close_VICE5_YuanHuanTi)
labelResult = Label(VICE5_root, text="вычисление объёма кольца", fg="blue")
labelR1 = Label(VICE5_root, text="Внешний радиус", fg="blue")
labelR2 = Label(VICE5_root, text="Внутренний радиус", fg="blue")
entryR1 = Entry(VICE5_root)
entryR2 = Entry(VICE5_root)
btnCalculate = Button(VICE5_root, text="Расчет", command=btnClicked)
labelResult.place(x=0, y=0)
labelR1.place(x=0, y=30)
labelR2.place(x=0, y=60)
entryR1.place(x=40, y=30)
entryR2.place(x=40, y=60)
btnCalculate.place(x=0, y=90)
close_button_VICE5_YuanHuanTi.place(x=295, y=0)
VICE5_root.mainloop()
def HZK():
def btnClicked():
r = float(entryR.get())
labelResult.config(text="Сфера с радиусом%.3f имеет объём%3.f" % (r, 4/3 * pi * r**3))
def close_VICE6_QiuTi():
VICE6_root.destroy()
VICE6_root = Tk(className='Сферические вычисления объема')
VICE6_root.geometry("350x300+0+0")
close_button_VICE6_QiuTi = Button(VICE6_root, text="↺Возвращение", fg='red', bd=0, command=close_VICE6_QiuTi)
labelResult = Label(VICE6_root, text="Сферические вычисления объема", fg="blue")
labelR = Label(VICE6_root, text="Радиус", fg="blue")
entryR = Entry(VICE6_root)
btnCalculate = Button(VICE6_root, text="Расчет", command=btnClicked)
labelResult.place(x=0, y=0)
labelR.place(x=0, y=30)
entryR.place(x=30, y=30)
btnCalculate.place(x=0, y=60)
close_button_VICE6_QiuTi.place(x=295, y=0)
VICE6_root.mainloop()
#主界面关闭函数体
def close_HOST():
root.destroy()
root = Tk(className = 'Калькулятор объема')
root.geometry("350x350+100+100")
root.overrideredirect(True)
l = Label(root,text = "Правильная графика",height=2,width=20,fg="orange")
close_button_HOST = Button(root,text = "×",height=1,width=5,font=("微软雅黑",15),fg = 'black',bd=0,command = close_HOST)
button1 = Button(root,text = "Квадрат",height=1,width=30,fg = 'red',command = SZH)
button2 = Button(root,text = "Прямоугольник",height=1,width=30,fg = 'red',command = HZS)
button3 = Button(root,text = "Цилиндр",height=1,width=30,fg = 'red',command = KZS)
button4 = Button(root,text = "Конус",height=1,width=30,fg = 'red',command = SZK)
button5 = Button(root,text = "Кольцо",height=1,width=30,fg = 'red',command = KZH)
button6 = Button(root,text = "Сфера",height=1,width=30,fg = 'red',command = HZK)
close_button_HOST.place(x=300,y=0)
l.pack()
button1.pack()
button2.pack()
button3.pack()
button4.pack()
button5.pack()
button6.pack()
root.mainloop()
root = Tk()
root.title("Генератор тем V10.5")
root.geometry("500x500+100+100")
date = topic()
label1 = Label(root, text=' ', font = ("微软雅黑", 15))
label1.place(x = 0, y = 30)
label2 = Label(root, text=' ', font = ("微软雅黑", 15))
label2.place(x = 0, y = 60)
label3 = Label(root, text=' ', font = ("微软雅黑", 15))
label3.place(x = 0, y = 90)
label4 = Label(root, text=' ', font = ("微软雅黑", 15))
label4.place(x = 0, y = 120)
label5 = Label(root, text=' ', font = ("微软雅黑", 15))
label5.place(x = 0, y = 150)
label6 = Label(root, text=' ', font = ("微软雅黑", 15))
label6.place(x = 0, y = 210)
label7 = Label(root, text=' ', font = ("微软雅黑", 15))
label7.place(x = 0, y = 240)
label8 = Label(root, text=' ', font = ("微软雅黑", 15))
label8.place(x = 0, y = 300)
label9 = Label(root, text=' ', font = ("微软雅黑", 15))
label9.place(x = 0, y = 330)
label10 = Label(root, text=' ', font = ("微软雅黑", 15))
label10.place(x = 0, y = 390)
label11 = Label(root, text=' ', font = ("微软雅黑", 15))
label11.place(x = 0, y = 420)
label = Label(root, text='Добро пожаловать в генератор тем!', font = ('微软雅黑', 20))
button = Button(root, text='Создать тему', font = ('微软雅黑', 15), command = butt)
menu = Menu(root)
file_menu = Menu(menu, tearoff=0)
temperature_menu = Menu(menu, tearoff=0)
file_menu.add_command(label="Восстановление", command=butt)
temperature_menu.add_command(label="температурный интервертор", command=temperature)
temperature_menu.add_command(label="Калькулятор объема",command=V)
menu.add_cascade(label="Документация", menu=file_menu)
menu.add_cascade(label="Больше.", menu=temperature_menu)
label.place(x = 7, y = 150)
button.place(x = 150, y = 200)
root.config(menu=menu)
root.mainloop()
"""
翻译均源于网络,可能有不准确,若发现错误,请提醒作者,会修改!!!
"""
分析
一、整体功能概述
这段Python代码构建了一个具有多种功能的图形用户界面(GUI)应用程序,主要功能包括语言选择、数学表达式生成、温度转换以及展示元素周期表等。
二、代码结构分析
(一)语言选择部分
- 界面构建
- 代码首先导入了
tkinter
相关的模块(from tkinter import *
,from tkinter import ttk
,from tkinter import Menu
)用于创建GUI界面。 - 创建了一个
Tk
对象root
,并设置其标题为“语言选择”。定义了一个包含三种语言(“中文”、“英语”、“俄文”)的列表languages
,通过ttk.Combobox
创建了一个下拉菜单language_combo
,用户可以在其中选择语言,并且默认选中第一项(language_combo.current(0)
)。
- 代码首先导入了
- 功能实现
- 定义了
submit_language
函数,当用户点击“确定”按钮(submit_button
)时,获取用户选择的语言并存储在selected_language
变量中,然后销毁root
窗口。
- 定义了
(二)数学表达式生成部分(假设选择中文后的操作)
- 函数定义
- 定义了多个函数用于生成不同类型的数学表达式。
calculate
函数用于生成一个包含乘法和加法的表达式,它随机生成两个在指定范围内的浮点数,进行一些计算后组合成表达式字符串并返回。equation_one
函数用于生成一元一次方程,随机生成方程的系数a
和b
,并根据系数的正负情况构建方程字符串。- 类似地,
equation_two
和equation_sd
函数分别用于生成二元一次方程和二次方程的表达式字符串。 topic
函数用于生成一系列的数学表达式,包括调用calculate
函数多次以及equation_one
、equation_two
和equation_sd
函数各两次,将结果存储在全局变量中。up_date
函数用于更新界面上的标签(label1
-label11
),将topic
函数生成的表达式显示在界面上。butt
函数用于销毁原有的标签和按钮,创建一个新的“重新生成”按钮,点击该按钮会重新生成并更新数学表达式。
(三)温度转换部分
- 函数结构
- 定义了
temperature
函数,在这个函数内部又定义了多个子函数用于不同温度单位之间的转换。 - 例如,
SZH
函数用于摄氏度转华氏度,它创建了一个新的Tk
窗口VICE1_root
,包含输入框、转换按钮和结果显示标签等组件,用户输入摄氏度值后点击转换按钮,在标签上显示转换后的华氏度值。 - 类似地,
HZS
、KZS
、SZK
、KZH
和HZK
函数分别实现了华氏度转摄氏度、热力学温度转摄氏度、摄氏度转热力学温度、热力学温度转华氏度、华氏度转热力学温度的功能,每个函数都创建了自己独立的Tk
窗口并构建了相应的转换界面。 - 还定义了
close_HOST
函数用于关闭温度转换的主界面。
- 定义了
(四)元素周期表展示部分
- 界面布局
- 定义了
Y
函数,创建了一个名为“元素周期表”的Tk
窗口window
,设置了窗口的大小、透明度(window.attributes("-alpha", 0.9)
)和不可调整大小(window.resizable(False, False)
)。 - 在窗口中添加了标题标签
L
,然后通过一系列的Label
组件分别展示了元素周期表中的元素信息,包括原子序数、化学符号、元素名称、相对原子质量等,并且按照族和周期的布局进行了排列。
- 定义了
三、代码的优点
- 功能丰富
- 整合了多种功能,如语言选择、数学计算、温度转换和元素周期表展示,能够满足不同用户在学习和计算方面的需求。
- 模块化设计
- 在温度转换部分,每个转换功能都被封装成独立的函数,使得代码结构清晰,易于理解和维护。