Python——二进制8位乘法器(采用原码一位乘计算原理实现)(tkinter实现)
本功能作者:
1.CSDN用户(TDTX),TDTX主页
博客园用户(TDTX),TDTX主页
【原码一位乘】逻辑右移与加法运算组合实现,其中加法运算采用前面加法器中介绍的实现过程。
1.mupym8bit.py
def mupym8bit():
import tkinter as tk
wind1=tk.Tk()
wind1.geometry('760x760+450+20')
wind1.title('八位乘法器(原码一位乘)')
#下面是清除所有文本框内容的函数功能
def detxt():
tx1.delete(0.0,tk.END)
tx2.delete(0.0,tk.END)
tx3.delete(0.0,tk.END)
tx4.delete(0.0,tk.END)
tx5.delete(0.0,tk.END)
tx6.delete(0.0,tk.END)
tx7.delete(0.0,tk.END)
tx8.delete(0.0,tk.END)
tx9.delete(0.0,tk.END)
tx10.delete(0.0,tk.END)
tx11.delete(0.0,tk.END)
tx12.delete(0.0,tk.END)
tx13.delete(0.0,tk.END)
tx14.delete(0.0,tk.END)
tx15.delete(0.0,tk.END)
tx16.delete(0.0,tk.END)
tx17.delete(0.0,tk.END)
txbfj1.delete(0.0,tk.END)
txcc1.delete(0.0,tk.END)
txsm1.delete(0.0,tk.END)
txbfj2.delete(0.0,tk.END)
txcc2.delete(0.0,tk.END)
txsm2.delete(0.0,tk.END)
txbfj3.delete(0.0,tk.END)
txcc3.delete(0.0,tk.END)
txsm3.delete(0.0,tk.END)
txbfj4.delete(0.0,tk.END)
txcc4.delete(0.0,tk.END)
txsm4.delete(0.0,tk.END)
txbfj5.delete(0.0,tk.END)
txcc5.delete(0.0,tk.END)
txsm5.delete(0.0,tk.END)
txsm6.delete(0.0,tk.END)
txbfj6.delete(0.0,tk.END)
txcc6.delete(0.0,tk.END)
txsm7.delete(0.0,tk.END)
txbfj7.delete(0.0,tk.END)
txcc7.delete(0.0,tk.END)
txsm8.delete(0.0,tk.END)
txbfj8.delete(0.0,tk.END)
txcc8.delete(0.0,tk.END)
txsm9.delete(0.0,tk.END)
txbfj9.delete(0.0,tk.END)
txcc9.delete(0.0,tk.END)
def mupym88bit():
nu1_1=eval(ent8.get()) #获得文本框中的数字保存到二进制数每一位的变量中
nu1_2=eval(ent7.get())
nu1_3=eval(ent6.get())
nu1_4=eval(ent5.get())
nu1_5=eval(ent4.get())
nu1_6=eval(ent3.get())
nu1_7=eval(ent2.get())
nu1_8=eval(ent1.get())
nu1_11=nu1_1
nu1_22=nu1_2
nu1_33=nu1_3
nu1_44=nu1_4
nu1_55=nu1_5
nu1_66=nu1_6
nu1_77=nu1_7
nu1_88=0
nu2_1=eval(ent16.get())
nu2_2=eval(ent15.get())
nu2_3=eval(ent14.get())
nu2_4=eval(ent13.get())
nu2_5=eval(ent12.get())
nu2_6=eval(ent11.get())
nu2_7=eval(ent10.get())
nu2_8=eval(ent9.get())
nu2_11=nu2_1
nu2_22=nu2_2
nu2_33=nu2_3
nu2_44=nu2_4
nu2_55=nu2_5
nu2_66=nu2_6
nu2_77=nu2_7
nu2_88=0
nubfj1=0 #二进制数部分积每一位的初始值
nubfj2=0
nubfj3=0
nubfj4=0
nubfj5=0
nubfj6=0
nubfj7=0
nubfj8=0
nusp1=0
nusp2=0
nusp3=0
nusp4=0
nusp5=0
nusp6=0
nusp7=0
nusp8=0
nujw=0
txcc1.insert('insert','{0} {1} {2} {3} {4} {5} {6} {7}'.format(nu2_88,nu2_77,nu2_66,nu2_55,nu2_44,nu2_33,nu2_22,nu2_11))
#下面是根据乘数最低位是1还是0,给部分积加上被乘数或者加上0,并产生步骤说明
if nu2_11==1:
txbfj1.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(0,0,0,0,0,0,0,0))
txbfj1.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,nu1_77,nu1_66,nu1_55,nu1_44,nu1_33,nu1_22,nu1_11))
txsm1.insert('insert','开始部分积Z0=0\n乘数为1,加上x*')
elif nu2_11==0:
txbfj1.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(0,0,0,0,0,0,0,0))
txbfj1.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,0,0,0,0,0,0,0))
txsm1.insert('insert','开始部分积Z0=0\n乘数为0,加上0')
if nu2_11==0:
nu1_11=0
nu1_22=0
nu1_33=0
nu1_44=0
nu1_55=0
nu1_66=0
nu1_77=0
nu1_88=0
elif nu2_11==1:
nu1_11=nu1_1
nu1_22=nu1_2
nu1_33=nu1_3
nu1_44=nu1_4
nu1_55=nu1_5
nu1_66=nu1_6
nu1_77=nu1_7
nu1_88=0
#下面开始部分积和被乘数或0作二进制加法运算
if nubfj1+nu1_11+nujw==1:
nusp1=1
nujw=0
elif nubfj1+nu1_11+nujw==0:
nusp1=0
nujw=0
elif nubfj1+nu1_11+nujw==2:
nusp1=0
nujw=1
elif nubfj1+nu1_11+nujw==3:
nusp1=1
nujw=1
if nubfj2+nu1_22+nujw==1:
nusp2=1
nujw=0
elif nubfj2+nu1_22+nujw==0:
nusp2=0
nujw=0
elif nubfj2+nu1_22+nujw==2:
nusp2=0
nujw=1
elif nubfj2+nu1_22+nujw==3:
nusp2=1
nujw=1
if nubfj3+nu1_33+nujw==1:
nusp3=1
nujw=0
elif nubfj3+nu1_33+nujw==0:
nusp3=0
nujw=0
elif nubfj3+nu1_33+nujw==2:
nusp3=0
nujw=1
elif nubfj3+nu1_33+nujw==3:
nusp3=1
nujw=1
if nubfj4+nu1_44+nujw==1:
nusp4=1
nujw=0
elif nubfj4+nu1_44+nujw==0:
nusp4=0
nujw=0
elif nubfj4+nu1_44+nujw==2:
nusp4=0
nujw=1
elif nubfj4+nu1_44+nujw==3:
nusp4=1
nujw=1
if nubfj5+nu1_55+nujw==1:
nusp5=1
nujw=0
elif nubfj5+nu1_55+nujw==0:
nusp5=0
nujw=0
elif nubfj5+nu1_55+nujw==2:
nusp5=0
nujw=1
elif nubfj5+nu1_55+nujw==3:
nusp5=1
nujw=1
if nubfj6+nu1_66+nujw==1:
nusp6=1
nujw=0
elif nubfj6+nu1_66+nujw==0:
nusp6=0
nujw=0
elif nubfj6+nu1_66+nujw==2:
nusp6=0
nujw=1
elif nubfj6+nu1_66+nujw==3:
nusp6=1
nujw=1
if nubfj7+nu1_77+nujw==1:
nusp7=1
nujw=0
elif nubfj7+nu1_77+nujw==0:
nusp7=0
nujw=0
elif nubfj7+nu1_77+nujw==2:
nusp7=0
nujw=1
elif nubfj7+nu1_77+nujw==3:
nusp7=1
nujw=1
if nubfj8+nu1_88+nujw==1:
nusp8=1
nujw=0
elif nubfj8+nu1_88+nujw==0:
nusp8=0
nujw=0
elif nubfj8+nu1_88+nujw==2:
nusp8=0
nujw=1
elif nubfj8+nu1_88+nujw==3:
nusp8=1
nujw=1
#将加法的结果作为新的部分积插入到文本框中,即将进行逻辑右移
txbfj2.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nusp8,nusp7,nusp6,nusp5,nusp4,nusp3,nusp2,nusp1))
#下面是乘数的逻辑右移,并最高位是部分移出的最低位数字
nu2_11=nu2_22
nu2_22=nu2_33
nu2_33=nu2_44
nu2_44=nu2_55
nu2_55=nu2_66
nu2_66=nu2_77
nu2_77=nu2_88
nu2_88=nusp1
txcc2.insert('insert','{0} {1} {2} {3} {4} {5} {6} {7}'.format(nu2_88,nu2_77,nu2_66,nu2_55,nu2_44,nu2_33,nu2_22,nu2_11))
if nu2_11==0:
nu1_11=0
nu1_22=0
nu1_33=0
nu1_44=0
nu1_55=0
nu1_66=0
nu1_77=0
nu1_88=0
elif nu2_11==1:
nu1_11=nu1_1
nu1_22=nu1_2
nu1_33=nu1_3
nu1_44=nu1_4
nu1_55=nu1_5
nu1_66=nu1_6
nu1_77=nu1_7
nu1_88=0
#下面是部分积的逻辑右移
nubfj1=nusp2
nubfj2=nusp3
nubfj3=nusp4
nubfj4=nusp5
nubfj5=nusp6
nubfj6=nusp7
nubfj7=nusp8
nubfj8=0
txbfj2.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nubfj8,nubfj7,nubfj6,nubfj5,nubfj4,nubfj3,nubfj2,nubfj1))
if nu2_11==1:
txbfj2.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,nu1_77,nu1_66,nu1_55,nu1_44,nu1_33,nu1_22,nu1_11))
txsm2.insert('insert','\n→1位得Z1,乘数同时→1位\n乘数为1,加上x*')
elif nu2_11==0:
txbfj2.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,0,0,0,0,0,0,0))
txsm2.insert('insert','\n→1位得Z1,乘数同时→1位\n乘数为0,加上0')
if nubfj1+nu1_11+nujw==1:
nusp1=1
nujw=0
elif nubfj1+nu1_11+nujw==0:
nusp1=0
nujw=0
elif nubfj1+nu1_11+nujw==2:
nusp1=0
nujw=1
elif nubfj1+nu1_11+nujw==3:
nusp1=1
nujw=1
if nubfj2+nu1_22+nujw==1:
nusp2=1
nujw=0
elif nubfj2+nu1_22+nujw==0:
nusp2=0
nujw=0
elif nubfj2+nu1_22+nujw==2:
nusp2=0
nujw=1
elif nubfj2+nu1_22+nujw==3:
nusp2=1
nujw=1
if nubfj3+nu1_33+nujw==1:
nusp3=1
nujw=0
elif nubfj3+nu1_33+nujw==0:
nusp3=0
nujw=0
elif nubfj3+nu1_33+nujw==2:
nusp3=0
nujw=1
elif nubfj3+nu1_33+nujw==3:
nusp3=1
nujw=1
if nubfj4+nu1_44+nujw==1:
nusp4=1
nujw=0
elif nubfj4+nu1_44+nujw==0:
nusp4=0
nujw=0
elif nubfj4+nu1_44+nujw==2:
nusp4=0
nujw=1
elif nubfj4+nu1_44+nujw==3:
nusp4=1
nujw=1
if nubfj5+nu1_55+nujw==1:
nusp5=1
nujw=0
elif nubfj5+nu1_55+nujw==0:
nusp5=0
nujw=0
elif nubfj5+nu1_55+nujw==2:
nusp5=0
nujw=1
elif nubfj5+nu1_55+nujw==3:
nusp5=1
nujw=1
if nubfj6+nu1_66+nujw==1:
nusp6=1
nujw=0
elif nubfj6+nu1_66+nujw==0:
nusp6=0
nujw=0
elif nubfj6+nu1_66+nujw==2:
nusp6=0
nujw=1
elif nubfj6+nu1_66+nujw==3:
nusp6=1
nujw=1
if nubfj7+nu1_77+nujw==1:
nusp7=1
nujw=0
elif nubfj7+nu1_77+nujw==0:
nusp7=0
nujw=0
elif nubfj7+nu1_77+nujw==2:
nusp7=0
nujw=1
elif nubfj7+nu1_77+nujw==3:
nusp7=1
nujw=1
if nubfj8+nu1_88+nujw==1:
nusp8=1
nujw=0
elif nubfj8+nu1_88+nujw==0:
nusp8=0
nujw=0
elif nubfj8+nu1_88+nujw==2:
nusp8=0
nujw=1
elif nubfj8+nu1_88+nujw==3:
nusp8=1
nujw=1
txbfj3.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nusp8,nusp7,nusp6,nusp5,nusp4,nusp3,nusp2,nusp1))
nu2_11=nu2_22
nu2_22=nu2_33
nu2_33=nu2_44
nu2_44=nu2_55
nu2_55=nu2_66
nu2_66=nu2_77
nu2_77=nu2_88
nu2_88=nusp1
txcc3.insert('insert','{0}\n{1} {2} {3} {4} {5} {6} {7} {8}'.format(nu2_2,nu2_88,nu2_77,nu2_66,nu2_55,nu2_44,nu2_33,nu2_22,nu2_11))
if nu2_11==0:
nu1_11=0
nu1_22=0
nu1_33=0
nu1_44=0
nu1_55=0
nu1_66=0
nu1_77=0
nu1_88=0
elif nu2_11==1:
nu1_11=nu1_1
nu1_22=nu1_2
nu1_33=nu1_3
nu1_44=nu1_4
nu1_55=nu1_5
nu1_66=nu1_6
nu1_77=nu1_7
nu1_88=0
nubfj1=nusp2
nubfj2=nusp3
nubfj3=nusp4
nubfj4=nusp5
nubfj5=nusp6
nubfj6=nusp7
nubfj7=nusp8
nubfj8=0
txbfj3.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nubfj8,nubfj7,nubfj6,nubfj5,nubfj4,nubfj3,nubfj2,nubfj1))
if nu2_11==1:
txbfj3.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,nu1_77,nu1_66,nu1_55,nu1_44,nu1_33,nu1_22,nu1_11))
txsm3.insert('insert','\n→1位得Z2,乘数同时→1位\n乘数为1,加上x*')
elif nu2_11==0:
txbfj3.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,0,0,0,0,0,0,0))
txsm3.insert('insert','\n→1位得Z2,乘数同时→1位\n乘数为0,加上0')
if nubfj1+nu1_11+nujw==1:
nusp1=1
nujw=0
elif nubfj1+nu1_11+nujw==0:
nusp1=0
nujw=0
elif nubfj1+nu1_11+nujw==2:
nusp1=0
nujw=1
elif nubfj1+nu1_11+nujw==3:
nusp1=1
nujw=1
if nubfj2+nu1_22+nujw==1:
nusp2=1
nujw=0
elif nubfj2+nu1_22+nujw==0:
nusp2=0
nujw=0
elif nubfj2+nu1_22+nujw==2:
nusp2=0
nujw=1
elif nubfj2+nu1_22+nujw==3:
nusp2=1
nujw=1
if nubfj3+nu1_33+nujw==1:
nusp3=1
nujw=0
elif nubfj3+nu1_33+nujw==0:
nusp3=0
nujw=0
elif nubfj3+nu1_33+nujw==2:
nusp3=0
nujw=1
elif nubfj3+nu1_33+nujw==3:
nusp3=1
nujw=1
if nubfj4+nu1_44+nujw==1:
nusp4=1
nujw=0
elif nubfj4+nu1_44+nujw==0:
nusp4=0
nujw=0
elif nubfj4+nu1_44+nujw==2:
nusp4=0
nujw=1
elif nubfj4+nu1_44+nujw==3:
nusp4=1
nujw=1
if nubfj5+nu1_55+nujw==1:
nusp5=1
nujw=0
elif nubfj5+nu1_55+nujw==0:
nusp5=0
nujw=0
elif nubfj5+nu1_55+nujw==2:
nusp5=0
nujw=1
elif nubfj5+nu1_55+nujw==3:
nusp5=1
nujw=1
if nubfj6+nu1_66+nujw==1:
nusp6=1
nujw=0
elif nubfj6+nu1_66+nujw==0:
nusp6=0
nujw=0
elif nubfj6+nu1_66+nujw==2:
nusp6=0
nujw=1
elif nubfj6+nu1_66+nujw==3:
nusp6=1
nujw=1
if nubfj7+nu1_77+nujw==1:
nusp7=1
nujw=0
elif nubfj7+nu1_77+nujw==0:
nusp7=0
nujw=0
elif nubfj7+nu1_77+nujw==2:
nusp7=0
nujw=1
elif nubfj7+nu1_77+nujw==3:
nusp7=1
nujw=1
if nubfj8+nu1_88+nujw==1:
nusp8=1
nujw=0
elif nubfj8+nu1_88+nujw==0:
nusp8=0
nujw=0
elif nubfj8+nu1_88+nujw==2:
nusp8=0
nujw=1
elif nubfj8+nu1_88+nujw==3:
nusp8=1
nujw=1
txbfj4.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nusp8,nusp7,nusp6,nusp5,nusp4,nusp3,nusp2,nusp1))
nu2_11=nu2_22
nu2_22=nu2_33
nu2_33=nu2_44
nu2_44=nu2_55
nu2_55=nu2_66
nu2_66=nu2_77
nu2_77=nu2_88
nu2_88=nusp1
txcc4.insert('insert','{0} {1}\n{2} {3} {4} {5} {6} {7} {8} {9}'.format(nu2_3,nu2_2,nu2_88,nu2_77,nu2_66,nu2_55,nu2_44,nu2_33,nu2_22,nu2_11))
if nu2_11==0:
nu1_11=0
nu1_22=0
nu1_33=0
nu1_44=0
nu1_55=0
nu1_66=0
nu1_77=0
nu1_88=0
elif nu2_11==1:
nu1_11=nu1_1
nu1_22=nu1_2
nu1_33=nu1_3
nu1_44=nu1_4
nu1_55=nu1_5
nu1_66=nu1_6
nu1_77=nu1_7
nu1_88=0
nubfj1=nusp2
nubfj2=nusp3
nubfj3=nusp4
nubfj4=nusp5
nubfj5=nusp6
nubfj6=nusp7
nubfj7=nusp8
nubfj8=0
txbfj4.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nubfj8,nubfj7,nubfj6,nubfj5,nubfj4,nubfj3,nubfj2,nubfj1))
if nu2_11==1:
txbfj4.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,nu1_77,nu1_66,nu1_55,nu1_44,nu1_33,nu1_22,nu1_11))
txsm4.insert('insert','\n→1位得Z3,乘数同时→1位\n乘数为1,加上x*')
elif nu2_11==0:
txbfj4.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,0,0,0,0,0,0,0))
txsm4.insert('insert','\n→1位得Z3,乘数同时→1位\n乘数为0,加上0')
if nubfj1+nu1_11+nujw==1:
nusp1=1
nujw=0
elif nubfj1+nu1_11+nujw==0:
nusp1=0
nujw=0
elif nubfj1+nu1_11+nujw==2:
nusp1=0
nujw=1
elif nubfj1+nu1_11+nujw==3:
nusp1=1
nujw=1
if nubfj2+nu1_22+nujw==1:
nusp2=1
nujw=0
elif nubfj2+nu1_22+nujw==0:
nusp2=0
nujw=0
elif nubfj2+nu1_22+nujw==2:
nusp2=0
nujw=1
elif nubfj2+nu1_22+nujw==3:
nusp2=1
nujw=1
if nubfj3+nu1_33+nujw==1:
nusp3=1
nujw=0
elif nubfj3+nu1_33+nujw==0:
nusp3=0
nujw=0
elif nubfj3+nu1_33+nujw==2:
nusp3=0
nujw=1
elif nubfj3+nu1_33+nujw==3:
nusp3=1
nujw=1
if nubfj4+nu1_44+nujw==1:
nusp4=1
nujw=0
elif nubfj4+nu1_44+nujw==0:
nusp4=0
nujw=0
elif nubfj4+nu1_44+nujw==2:
nusp4=0
nujw=1
elif nubfj4+nu1_44+nujw==3:
nusp4=1
nujw=1
if nubfj5+nu1_55+nujw==1:
nusp5=1
nujw=0
elif nubfj5+nu1_55+nujw==0:
nusp5=0
nujw=0
elif nubfj5+nu1_55+nujw==2:
nusp5=0
nujw=1
elif nubfj5+nu1_55+nujw==3:
nusp5=1
nujw=1
if nubfj6+nu1_66+nujw==1:
nusp6=1
nujw=0
elif nubfj6+nu1_66+nujw==0:
nusp6=0
nujw=0
elif nubfj6+nu1_66+nujw==2:
nusp6=0
nujw=1
elif nubfj6+nu1_66+nujw==3:
nusp6=1
nujw=1
if nubfj7+nu1_77+nujw==1:
nusp7=1
nujw=0
elif nubfj7+nu1_77+nujw==0:
nusp7=0
nujw=0
elif nubfj7+nu1_77+nujw==2:
nusp7=0
nujw=1
elif nubfj7+nu1_77+nujw==3:
nusp7=1
nujw=1
if nubfj8+nu1_88+nujw==1:
nusp8=1
nujw=0
elif nubfj8+nu1_88+nujw==0:
nusp8=0
nujw=0
elif nubfj8+nu1_88+nujw==2:
nusp8=0
nujw=1
elif nubfj8+nu1_88+nujw==3:
nusp8=1
nujw=1
txbfj5.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nusp8,nusp7,nusp6,nusp5,nusp4,nusp3,nusp2,nusp1))
nu2_11=nu2_22
nu2_22=nu2_33
nu2_33=nu2_44
nu2_44=nu2_55
nu2_55=nu2_66
nu2_66=nu2_77
nu2_77=nu2_88
nu2_88=nusp1
txcc5.insert('insert','{0} {1} {2}\n{3} {4} {5} {6} {7} {8} {9} {10}'.format(nu2_4,nu2_3,nu2_2,nu2_88,nu2_77,nu2_66,nu2_55,nu2_44,nu2_33,nu2_22,nu2_11))
if nu2_11==0:
nu1_11=0
nu1_22=0
nu1_33=0
nu1_44=0
nu1_55=0
nu1_66=0
nu1_77=0
nu1_88=0
elif nu2_11==1:
nu1_11=nu1_1
nu1_22=nu1_2
nu1_33=nu1_3
nu1_44=nu1_4
nu1_55=nu1_5
nu1_66=nu1_6
nu1_77=nu1_7
nu1_88=0
nubfj1=nusp2
nubfj2=nusp3
nubfj3=nusp4
nubfj4=nusp5
nubfj5=nusp6
nubfj6=nusp7
nubfj7=nusp8
nubfj8=0
txbfj5.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nubfj8,nubfj7,nubfj6,nubfj5,nubfj4,nubfj3,nubfj2,nubfj1))
if nu2_11==1:
txbfj5.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,nu1_77,nu1_66,nu1_55,nu1_44,nu1_33,nu1_22,nu1_11))
txsm5.insert('insert','\n→1位得Z4,乘数同时→1位\n乘数为1,加上x*')
elif nu2_11==0:
txbfj5.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,0,0,0,0,0,0,0))
txsm5.insert('insert','\n→1位得Z4,乘数同时→1位\n乘数为0,加上0')
if nubfj1+nu1_11+nujw==1:
nusp1=1
nujw=0
elif nubfj1+nu1_11+nujw==0:
nusp1=0
nujw=0
elif nubfj1+nu1_11+nujw==2:
nusp1=0
nujw=1
elif nubfj1+nu1_11+nujw==3:
nusp1=1
nujw=1
if nubfj2+nu1_22+nujw==1:
nusp2=1
nujw=0
elif nubfj2+nu1_22+nujw==0:
nusp2=0
nujw=0
elif nubfj2+nu1_22+nujw==2:
nusp2=0
nujw=1
elif nubfj2+nu1_22+nujw==3:
nusp2=1
nujw=1
if nubfj3+nu1_33+nujw==1:
nusp3=1
nujw=0
elif nubfj3+nu1_33+nujw==0:
nusp3=0
nujw=0
elif nubfj3+nu1_33+nujw==2:
nusp3=0
nujw=1
elif nubfj3+nu1_33+nujw==3:
nusp3=1
nujw=1
if nubfj4+nu1_44+nujw==1:
nusp4=1
nujw=0
elif nubfj4+nu1_44+nujw==0:
nusp4=0
nujw=0
elif nubfj4+nu1_44+nujw==2:
nusp4=0
nujw=1
elif nubfj4+nu1_44+nujw==3:
nusp4=1
nujw=1
if nubfj5+nu1_55+nujw==1:
nusp5=1
nujw=0
elif nubfj5+nu1_55+nujw==0:
nusp5=0
nujw=0
elif nubfj5+nu1_55+nujw==2:
nusp5=0
nujw=1
elif nubfj5+nu1_55+nujw==3:
nusp5=1
nujw=1
if nubfj6+nu1_66+nujw==1:
nusp6=1
nujw=0
elif nubfj6+nu1_66+nujw==0:
nusp6=0
nujw=0
elif nubfj6+nu1_66+nujw==2:
nusp6=0
nujw=1
elif nubfj6+nu1_66+nujw==3:
nusp6=1
nujw=1
if nubfj7+nu1_77+nujw==1:
nusp7=1
nujw=0
elif nubfj7+nu1_77+nujw==0:
nusp7=0
nujw=0
elif nubfj7+nu1_77+nujw==2:
nusp7=0
nujw=1
elif nubfj7+nu1_77+nujw==3:
nusp7=1
nujw=1
if nubfj8+nu1_88+nujw==1:
nusp8=1
nujw=0
elif nubfj8+nu1_88+nujw==0:
nusp8=0
nujw=0
elif nubfj8+nu1_88+nujw==2:
nusp8=0
nujw=1
elif nubfj8+nu1_88+nujw==3:
nusp8=1
nujw=1
txbfj6.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nusp8,nusp7,nusp6,nusp5,nusp4,nusp3,nusp2,nusp1))
nu2_11=nu2_22
nu2_22=nu2_33
nu2_33=nu2_44
nu2_44=nu2_55
nu2_55=nu2_66
nu2_66=nu2_77
nu2_77=nu2_88
nu2_88=nusp1
txcc6.insert('insert','{0} {1} {2} {3}\n{4} {5} {6} {7} {8} {9} {10} {11}'.format(nu2_5,nu2_4,nu2_3,nu2_2,nu2_88,nu2_77,nu2_66,nu2_55,nu2_44,nu2_33,nu2_22,nu2_11))
if nu2_11==0:
nu1_11=0
nu1_22=0
nu1_33=0
nu1_44=0
nu1_55=0
nu1_66=0
nu1_77=0
nu1_88=0
elif nu2_11==1:
nu1_11=nu1_1
nu1_22=nu1_2
nu1_33=nu1_3
nu1_44=nu1_4
nu1_55=nu1_5
nu1_66=nu1_6
nu1_77=nu1_7
nu1_88=0
nubfj1=nusp2
nubfj2=nusp3
nubfj3=nusp4
nubfj4=nusp5
nubfj5=nusp6
nubfj6=nusp7
nubfj7=nusp8
nubfj8=0
txbfj6.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nubfj8,nubfj7,nubfj6,nubfj5,nubfj4,nubfj3,nubfj2,nubfj1))
if nu2_11==1:
txbfj6.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,nu1_77,nu1_66,nu1_55,nu1_44,nu1_33,nu1_22,nu1_11))
txsm6.insert('insert','\n→1位得Z5,乘数同时→1位\n乘数为1,加上x*')
elif nu2_11==0:
txbfj6.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,0,0,0,0,0,0,0))
txsm6.insert('insert','\n→1位得Z5,乘数同时→1位\n乘数为0,加上0')
if nubfj1+nu1_11+nujw==1:
nusp1=1
nujw=0
elif nubfj1+nu1_11+nujw==0:
nusp1=0
nujw=0
elif nubfj1+nu1_11+nujw==2:
nusp1=0
nujw=1
elif nubfj1+nu1_11+nujw==3:
nusp1=1
nujw=1
if nubfj2+nu1_22+nujw==1:
nusp2=1
nujw=0
elif nubfj2+nu1_22+nujw==0:
nusp2=0
nujw=0
elif nubfj2+nu1_22+nujw==2:
nusp2=0
nujw=1
elif nubfj2+nu1_22+nujw==3:
nusp2=1
nujw=1
if nubfj3+nu1_33+nujw==1:
nusp3=1
nujw=0
elif nubfj3+nu1_33+nujw==0:
nusp3=0
nujw=0
elif nubfj3+nu1_33+nujw==2:
nusp3=0
nujw=1
elif nubfj3+nu1_33+nujw==3:
nusp3=1
nujw=1
if nubfj4+nu1_44+nujw==1:
nusp4=1
nujw=0
elif nubfj4+nu1_44+nujw==0:
nusp4=0
nujw=0
elif nubfj4+nu1_44+nujw==2:
nusp4=0
nujw=1
elif nubfj4+nu1_44+nujw==3:
nusp4=1
nujw=1
if nubfj5+nu1_55+nujw==1:
nusp5=1
nujw=0
elif nubfj5+nu1_55+nujw==0:
nusp5=0
nujw=0
elif nubfj5+nu1_55+nujw==2:
nusp5=0
nujw=1
elif nubfj5+nu1_55+nujw==3:
nusp5=1
nujw=1
if nubfj6+nu1_66+nujw==1:
nusp6=1
nujw=0
elif nubfj6+nu1_66+nujw==0:
nusp6=0
nujw=0
elif nubfj6+nu1_66+nujw==2:
nusp6=0
nujw=1
elif nubfj6+nu1_66+nujw==3:
nusp6=1
nujw=1
if nubfj7+nu1_77+nujw==1:
nusp7=1
nujw=0
elif nubfj7+nu1_77+nujw==0:
nusp7=0
nujw=0
elif nubfj7+nu1_77+nujw==2:
nusp7=0
nujw=1
elif nubfj7+nu1_77+nujw==3:
nusp7=1
nujw=1
if nubfj8+nu1_88+nujw==1:
nusp8=1
nujw=0
elif nubfj8+nu1_88+nujw==0:
nusp8=0
nujw=0
elif nubfj8+nu1_88+nujw==2:
nusp8=0
nujw=1
elif nubfj8+nu1_88+nujw==3:
nusp8=1
nujw=1
txbfj7.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nusp8,nusp7,nusp6,nusp5,nusp4,nusp3,nusp2,nusp1))
nu2_11=nu2_22
nu2_22=nu2_33
nu2_33=nu2_44
nu2_44=nu2_55
nu2_55=nu2_66
nu2_66=nu2_77
nu2_77=nu2_88
nu2_88=nusp1
txcc7.insert('insert','{0} {1} {2} {3} {4}\n{0} {5} {6} {7} {8} {9} {10} {11}'.format(nu2_6,nu2_5,nu2_4,nu2_3,nu2_2,nu2_88,nu2_77,nu2_66,nu2_55,nu2_44,nu2_33,nu2_22,nu2_11))
if nu2_11==0:
nu1_11=0
nu1_22=0
nu1_33=0
nu1_44=0
nu1_55=0
nu1_66=0
nu1_77=0
nu1_88=0
elif nu2_11==1:
nu1_11=nu1_1
nu1_22=nu1_2
nu1_33=nu1_3
nu1_44=nu1_4
nu1_55=nu1_5
nu1_66=nu1_6
nu1_77=nu1_7
nu1_88=0
nubfj1=nusp2
nubfj2=nusp3
nubfj3=nusp4
nubfj4=nusp5
nubfj5=nusp6
nubfj6=nusp7
nubfj7=nusp8
nubfj8=0
txbfj7.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nubfj8,nubfj7,nubfj6,nubfj5,nubfj4,nubfj3,nubfj2,nubfj1))
if nu2_11==1:
txbfj7.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,nu1_77,nu1_66,nu1_55,nu1_44,nu1_33,nu1_22,nu1_11))
txsm7.insert('insert','\n→1位得Z6,乘数同时→1位\n乘数为1,加上x*')
elif nu2_11==0:
txbfj7.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,0,0,0,0,0,0,0))
txsm7.insert('insert','\n→1位得Z6,乘数同时→1位\n乘数为0,加上0')
if nubfj1+nu1_11+nujw==1:
nusp1=1
nujw=0
elif nubfj1+nu1_11+nujw==0:
nusp1=0
nujw=0
elif nubfj1+nu1_11+nujw==2:
nusp1=0
nujw=1
elif nubfj1+nu1_11+nujw==3:
nusp1=1
nujw=1
if nubfj2+nu1_22+nujw==1:
nusp2=1
nujw=0
elif nubfj2+nu1_22+nujw==0:
nusp2=0
nujw=0
elif nubfj2+nu1_22+nujw==2:
nusp2=0
nujw=1
elif nubfj2+nu1_22+nujw==3:
nusp2=1
nujw=1
if nubfj3+nu1_33+nujw==1:
nusp3=1
nujw=0
elif nubfj3+nu1_33+nujw==0:
nusp3=0
nujw=0
elif nubfj3+nu1_33+nujw==2:
nusp3=0
nujw=1
elif nubfj3+nu1_33+nujw==3:
nusp3=1
nujw=1
if nubfj4+nu1_44+nujw==1:
nusp4=1
nujw=0
elif nubfj4+nu1_44+nujw==0:
nusp4=0
nujw=0
elif nubfj4+nu1_44+nujw==2:
nusp4=0
nujw=1
elif nubfj4+nu1_44+nujw==3:
nusp4=1
nujw=1
if nubfj5+nu1_55+nujw==1:
nusp5=1
nujw=0
elif nubfj5+nu1_55+nujw==0:
nusp5=0
nujw=0
elif nubfj5+nu1_55+nujw==2:
nusp5=0
nujw=1
elif nubfj5+nu1_55+nujw==3:
nusp5=1
nujw=1
if nubfj6+nu1_66+nujw==1:
nusp6=1
nujw=0
elif nubfj6+nu1_66+nujw==0:
nusp6=0
nujw=0
elif nubfj6+nu1_66+nujw==2:
nusp6=0
nujw=1
elif nubfj6+nu1_66+nujw==3:
nusp6=1
nujw=1
if nubfj7+nu1_77+nujw==1:
nusp7=1
nujw=0
elif nubfj7+nu1_77+nujw==0:
nusp7=0
nujw=0
elif nubfj7+nu1_77+nujw==2:
nusp7=0
nujw=1
elif nubfj7+nu1_77+nujw==3:
nusp7=1
nujw=1
if nubfj8+nu1_88+nujw==1:
nusp8=1
nujw=0
elif nubfj8+nu1_88+nujw==0:
nusp8=0
nujw=0
elif nubfj8+nu1_88+nujw==2:
nusp8=0
nujw=1
elif nubfj8+nu1_88+nujw==3:
nusp8=1
nujw=1
txbfj8.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nusp8,nusp7,nusp6,nusp5,nusp4,nusp3,nusp2,nusp1))
nu2_11=nu2_22
nu2_22=nu2_33
nu2_33=nu2_44
nu2_44=nu2_55
nu2_55=nu2_66
nu2_66=nu2_77
nu2_77=nu2_88
nu2_88=nusp1
txcc8.insert('insert','{0} {1} {2} {3} {4} {5}\n{6} {7} {8} {9} {10} {11} {12} {13}'.format(nu2_7,nu2_6,nu2_5,nu2_4,nu2_3,nu2_2,nu2_88,nu2_77,nu2_66,nu2_55,nu2_44,nu2_33,nu2_22,nu2_11))
if nu2_11==0:
nu1_11=0
nu1_22=0
nu1_33=0
nu1_44=0
nu1_55=0
nu1_66=0
nu1_77=0
nu1_88=0
elif nu2_11==1:
nu1_11=nu1_1
nu1_22=nu1_2
nu1_33=nu1_3
nu1_44=nu1_4
nu1_55=nu1_5
nu1_66=nu1_6
nu1_77=nu1_7
nu1_88=0
nubfj1=nusp2
nubfj2=nusp3
nubfj3=nusp4
nubfj4=nusp5
nubfj5=nusp6
nubfj6=nusp7
nubfj7=nusp8
nubfj8=0
txbfj8.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nubfj8,nubfj7,nubfj6,nubfj5,nubfj4,nubfj3,nubfj2,nubfj1))
if nu2_11==1:
txbfj8.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,nu1_77,nu1_66,nu1_55,nu1_44,nu1_33,nu1_22,nu1_11))
txsm8.insert('insert','\n→1位得Z7,乘数同时→1位\n乘数为1,加上x*')
elif nu2_11==0:
txbfj8.insert('insert','+{0} {1} {2} {3} {4} {5} {6} {7}'.format(0,0,0,0,0,0,0,0))
txsm8.insert('insert','\n→1位得Z7,乘数同时→1位\n乘数为0,加上0')
if nubfj1+nu1_11+nujw==1:
nusp1=1
nujw=0
elif nubfj1+nu1_11+nujw==0:
nusp1=0
nujw=0
elif nubfj1+nu1_11+nujw==2:
nusp1=0
nujw=1
elif nubfj1+nu1_11+nujw==3:
nusp1=1
nujw=1
if nubfj2+nu1_22+nujw==1:
nusp2=1
nujw=0
elif nubfj2+nu1_22+nujw==0:
nusp2=0
nujw=0
elif nubfj2+nu1_22+nujw==2:
nusp2=0
nujw=1
elif nubfj2+nu1_22+nujw==3:
nusp2=1
nujw=1
if nubfj3+nu1_33+nujw==1:
nusp3=1
nujw=0
elif nubfj3+nu1_33+nujw==0:
nusp3=0
nujw=0
elif nubfj3+nu1_33+nujw==2:
nusp3=0
nujw=1
elif nubfj3+nu1_33+nujw==3:
nusp3=1
nujw=1
if nubfj4+nu1_44+nujw==1:
nusp4=1
nujw=0
elif nubfj4+nu1_44+nujw==0:
nusp4=0
nujw=0
elif nubfj4+nu1_44+nujw==2:
nusp4=0
nujw=1
elif nubfj4+nu1_44+nujw==3:
nusp4=1
nujw=1
if nubfj5+nu1_55+nujw==1:
nusp5=1
nujw=0
elif nubfj5+nu1_55+nujw==0:
nusp5=0
nujw=0
elif nubfj5+nu1_55+nujw==2:
nusp5=0
nujw=1
elif nubfj5+nu1_55+nujw==3:
nusp5=1
nujw=1
if nubfj6+nu1_66+nujw==1:
nusp6=1
nujw=0
elif nubfj6+nu1_66+nujw==0:
nusp6=0
nujw=0
elif nubfj6+nu1_66+nujw==2:
nusp6=0
nujw=1
elif nubfj6+nu1_66+nujw==3:
nusp6=1
nujw=1
if nubfj7+nu1_77+nujw==1:
nusp7=1
nujw=0
elif nubfj7+nu1_77+nujw==0:
nusp7=0
nujw=0
elif nubfj7+nu1_77+nujw==2:
nusp7=0
nujw=1
elif nubfj7+nu1_77+nujw==3:
nusp7=1
nujw=1
if nubfj8+nu1_88+nujw==1:
nusp8=1
nujw=0
elif nubfj8+nu1_88+nujw==0:
nusp8=0
nujw=0
elif nubfj8+nu1_88+nujw==2:
nusp8=0
nujw=1
elif nubfj8+nu1_88+nujw==3:
nusp8=1
nujw=1
txbfj9.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nusp8,nusp7,nusp6,nusp5,nusp4,nusp3,nusp2,nusp1))
nu2_11=nu2_22
nu2_22=nu2_33
nu2_33=nu2_44
nu2_44=nu2_55
nu2_55=nu2_66
nu2_66=nu2_77
nu2_77=nu2_88
nu2_88=nusp1
txcc9.insert('insert','0 {0} {1} {2} {3} {4} {5}\n{6} {7} {8} {9} {10} {11} {12} {13}'.format(nu2_7,nu2_6,nu2_5,nu2_4,nu2_3,nu2_2,nu2_88,nu2_77,nu2_66,nu2_55,nu2_44,nu2_33,nu2_22,nu2_11))
nubfj1=nusp2
nubfj2=nusp3
nubfj3=nusp4
nubfj4=nusp5
nubfj5=nusp6
nubfj6=nusp7
nubfj7=nusp8
nubfj8=0
txbfj9.insert('insert',' {0} {1} {2} {3} {4} {5} {6} {7}\n'.format(nubfj8,nubfj7,nubfj6,nubfj5,nubfj4,nubfj3,nubfj2,nubfj1))
txsm9.insert('insert','\n→1位得Z8,乘数已全部移出')
if nu1_8==nu2_8:
tx16.insert('insert',nubfj8)
tx17.insert('insert',"{0}异或{1}是:0\n即为第十六位符号位!".format(nu1_8,nu2_8))
else:
tx16.insert('insert',1)
tx17.insert('insert',"{0}异或{1}是:1\n即为第十六位符号位!".format(nu1_8,nu2_8))
tx15.insert('insert',nubfj7)
tx14.insert('insert',nubfj6)
tx13.insert('insert',nubfj5)
tx12.insert('insert',nubfj4)
tx11.insert('insert',nubfj3)
tx10.insert('insert',nubfj2)
tx9.insert('insert',nubfj1)
tx8.insert('insert',nu2_88)
tx7.insert('insert',nu2_77)
tx6.insert('insert',nu2_66)
tx5.insert('insert',nu2_55)
tx4.insert('insert',nu2_44)
tx3.insert('insert',nu2_33)
tx2.insert('insert',nu2_22)
tx1.insert('insert',nu2_11)
#下面是界面上各组件的生成与排布
lb1=tk.Label(wind1,text='输入数字1:',fg='blue',width=10,height=2)
lb1.place(x=100,y=30)
ent1=tk.Entry(wind1,width=3)
ent1.place(x=120,y=60)
ent2=tk.Entry(wind1,width=3)
ent2.place(x=146,y=60)
ent3=tk.Entry(wind1,width=3)
ent3.place(x=172,y=60)
ent4=tk.Entry(wind1,width=3)
ent4.place(x=198,y=60)
ent5=tk.Entry(wind1,width=3)
ent5.place(x=224,y=60)
ent6=tk.Entry(wind1,width=3)
ent6.place(x=250,y=60)
ent7=tk.Entry(wind1,width=3)
ent7.place(x=276,y=60)
ent8=tk.Entry(wind1,width=3)
ent8.place(x=302,y=60)
lbs=tk.Label(wind1,text='x',font=('Arial', 14))
lbs.place(x=345,y=60)
lb2=tk.Label(wind1,text='输入数字2:',fg='blue',width=10,height=2)
lb2.place(x=355,y=30)
ent9=tk.Entry(wind1,width=3)
ent9.place(x=381,y=60)
ent10=tk.Entry(wind1,width=3)
ent10.place(x=407,y=60)
ent11=tk.Entry(wind1,width=3)
ent11.place(x=433,y=60)
ent12=tk.Entry(wind1,width=3)
ent12.place(x=459,y=60)
ent13=tk.Entry(wind1,width=3)
ent13.place(x=485,y=60)
ent14=tk.Entry(wind1,width=3)
ent14.place(x=511,y=60)
ent15=tk.Entry(wind1,width=3)
ent15.place(x=537,y=60)
ent16=tk.Entry(wind1,width=3)
ent16.place(x=563,y=60)
bt1=tk.Button(wind1,text='相乘',command=mupym88bit)
bt1.place(x=620,y=60)
btdetx=tk.Button(wind1,text='清除',command=detxt)
btdetx.place(x=680,y=60)
lbsm=tk.Label(wind1,text='部分积\t\t\t乘数\t\t\t说明',fg='blue',height=2)
lbsm.place(x=100,y=90)
lbfj1=tk.Label(wind1,text='-----------------------------------------------------------------------------------------------------------------')
lbfj1.place(x=60,y=120)
txbfj1=tk.Text(wind1,width=22,height=4)
txbfj1.place(x=100,y=135)
txcc1=tk.Text(wind1,width=22,height=4)
txcc1.place(x=270,y=135)
txsm1=tk.Text(wind1,width=25,height=4)
txsm1.place(x=440,y=135)
txbfj2=tk.Text(wind1,width=22,height=4)
txbfj2.place(x=100,y=190)
txcc2=tk.Text(wind1,width=22,height=4)
txcc2.place(x=270,y=190)
txsm2=tk.Text(wind1,width=25,height=4)
txsm2.place(x=440,y=190)
txbfj3=tk.Text(wind1,width=22,height=4)
txbfj3.place(x=100,y=245)
txcc3=tk.Text(wind1,width=22,height=4)
txcc3.place(x=270,y=245)
txsm3=tk.Text(wind1,width=25,height=4)
txsm3.place(x=440,y=245)
txbfj4=tk.Text(wind1,width=22,height=4)
txbfj4.place(x=100,y=300)
txcc4=tk.Text(wind1,width=22,height=4)
txcc4.place(x=270,y=300)
txsm4=tk.Text(wind1,width=25,height=4)
txsm4.place(x=440,y=300)
txbfj5=tk.Text(wind1,width=22,height=4)
txbfj5.place(x=100,y=355)
txcc5=tk.Text(wind1,width=22,height=4)
txcc5.place(x=270,y=355)
txsm5=tk.Text(wind1,width=25,height=4)
txsm5.place(x=440,y=355)
txbfj6=tk.Text(wind1,width=22,height=4)
txbfj6.place(x=100,y=410)
txcc6=tk.Text(wind1,width=22,height=4)
txcc6.place(x=270,y=410)
txsm6=tk.Text(wind1,width=25,height=4)
txsm6.place(x=440,y=410)
txbfj7=tk.Text(wind1,width=22,height=4)
txbfj7.place(x=100,y=465)
txcc7=tk.Text(wind1,width=22,height=4)
txcc7.place(x=270,y=465)
txsm7=tk.Text(wind1,width=25,height=4)
txsm7.place(x=440,y=465)
txbfj8=tk.Text(wind1,width=22,height=4)
txbfj8.place(x=100,y=520)
txcc8=tk.Text(wind1,width=22,height=4)
txcc8.place(x=270,y=520)
txsm8=tk.Text(wind1,width=25,height=4)
txsm8.place(x=440,y=520)
txbfj9=tk.Text(wind1,width=22,height=4)
txbfj9.place(x=100,y=575)
txcc9=tk.Text(wind1,width=22,height=4)
txcc9.place(x=270,y=575)
txsm9=tk.Text(wind1,width=25,height=4)
txsm9.place(x=440,y=575)
lbfj2=tk.Label(wind1,text='-----------------------------------------------------------------------------------------------------------------')
lbfj2.place(x=60,y=630)
lb4=tk.Label(wind1,text='数字1x数字2结果为(原码):')
lb4.place(x=90,y=645)
tx1=tk.Text(wind1,width=3,height=1)
tx1.place(x=510,y=670)
tx2=tk.Text(wind1,width=3,height=1)
tx2.place(x=484,y=670)
tx3=tk.Text(wind1,width=3,height=1)
tx3.place(x=458,y=670)
tx4=tk.Text(wind1,width=3,height=1)
tx4.place(x=432,y=670)
tx5=tk.Text(wind1,width=3,height=1)
tx5.place(x=406,y=670)
tx6=tk.Text(wind1,width=3,height=1)
tx6.place(x=380,y=670)
tx7=tk.Text(wind1,width=3,height=1)
tx7.place(x=354,y=670)
tx8=tk.Text(wind1,width=3,height=1)
tx8.place(x=328,y=670)
tx9=tk.Text(wind1,width=3,height=1)
tx9.place(x=302,y=670)
tx10=tk.Text(wind1,width=3,height=1)
tx10.place(x=276,y=670)
tx11=tk.Text(wind1,width=3,height=1)
tx11.place(x=250,y=670)
tx12=tk.Text(wind1,width=3,height=1)
tx12.place(x=224,y=670)
tx13=tk.Text(wind1,width=3,height=1)
tx13.place(x=198,y=670)
tx14=tk.Text(wind1,width=3,height=1)
tx14.place(x=172,y=670)
tx15=tk.Text(wind1,width=3,height=1)
tx15.place(x=146,y=670)
tx16=tk.Text(wind1,width=3,height=1)
tx16.place(x=120,y=670)
tx17=tk.Text(wind1,width=13,height=5)
tx17.place(x=560,y=670)
lbbs=tk.Label(wind1,text='15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0',fg='red')
lbbs.place(x=120,y=688)
wind1.mainloop()
2.结果示例
【重新输入数据后,点击“清除”按钮,会删除掉所有输出文本框中的内容!】