本功能作者:
1.CSDN用户(philo42),philo42主页
2.CSDN用户(TDTX),TDTX主页
博客园用户(TDTX),TDTX主页
def yutu(): import tkinter as tk windyu=tk.Tk() windyu.title('逻辑与及图示') windyu.geometry('500x500') def qyu(): tx5.delete(1.0,'end') tx6.delete(1.0,'end') tx7.delete(1.0,'end') tx.delete(0.0,tk.END) q=eval(ent1.get()) p=eval(ent2.get()) if q!=0 and p!=0: tx.insert('insert',1) tx7.insert('insert',1) else: tx.insert('insert',0) tx7.insert('insert',0) tx5.insert('insert',q) tx6.insert('insert',p) lb1=tk.Label(windyu,text='输入q值:',fg='blue',width=10,height=2) lb1.place(x=100,y=30) ent1=tk.Entry(windyu,width=5) ent1.place(x=170,y=35) lbs=tk.Label(windyu,text='&&',fg='red') lbs.place(x=207,y=35) lb2=tk.Label(windyu,text='输入p值:',fg='blue',width=10,height=2) lb2.place(x=230,y=30) ent2=tk.Entry(windyu,width=5) ent2.place(x=300,y=35) bt1=tk.Button(windyu,text='求解q&&p',command=qyu) bt1.place(x=200,y=70) lbf=tk.Label(windyu,text='-----------------------------------------------') lbf.place(x=110,y=95) lb3=tk.Label(windyu,text='q&&p值为:',fg='blue',bg='yellow') lb3.place(x=200,y=120) tx=tk.Text(windyu,width=2,height=1) tx.place(x=230,y=150) canvas=tk.Canvas(windyu,bg='white',height=100,width=280) line=canvas.create_line(20,40,90,40) line=canvas.create_line(50,40,40,46) line=canvas.create_line(50,40,40,34) line=canvas.create_line(20,60,90,60) line=canvas.create_line(50,60,40,66) line=canvas.create_line(50,60,40,54) line=canvas.create_line(90,75,90,25) line=canvas.create_line(90,75,140,75) line=canvas.create_line(90,25,140,25) #arc = canvas.create_arc(100,25,150,75,start=270,extent=180,style=tk.ARC) arc = canvas.create_arc(100,25,170,75,start=270,extent=180,style=tk.ARC) #arc = canvas.create_arc(76,25,180,75,start=270,extent=180,style=tk.ARC) line=canvas.create_line(170,50,250,50) line=canvas.create_line(210,50,200,56) line=canvas.create_line(210,50,200,44) canvas.place(x=100,y=200) lb4=tk.Label(windyu,text='q') lb4.place(x=120,y=210) lb5=tk.Label(windyu,text='p') lb5.place(x=120,y=270) lb6=tk.Label(windyu,text='q&&p') lb6.place(x=270,y=220) tx5=tk.Text(windyu,width=6,height=1) tx5.place(x=143,y=210) tx6=tk.Text(windyu,width=6,height=1) tx6.place(x=143,y=270) tx7=tk.Text(windyu,width=6,height=1) tx7.place(x=320,y=220) windyu.mainloop