0
import time
import sys
import Tkinter
from Tkinter import *

aa = Tk()
aa.title("SPUR GEAR CALCULATIONS")
aa.geometry("600x500+100+100")
aa.grid()

z = Label (aa, text=("WELCOME TO THE SOFTWARE SOLUTION OF MECHANICAL PROJECTS"),font=3)
z.place(x=30,y=5)

x = Label (aa, text="BY    AATHIF  AHMED  O   F ",font=1)
x.place(x=180,y=30)

c = Label (aa, text="------------------------------------------------------------------        ------------------------------------------------------------------------------------------ ",)
c.place(x=0,y=50)

v = Label (aa, text="GIVEN DATA:")
v.place(x=0,y=65)

b = Label (aa, text="Module, m = ")
b.place(x=0,y=80)

n = Label (aa, text="No. of teeth, Z = ")
n.place(x=0,y=100)

L1 = Variable
L1 = Entry (aa,width=10)
L1.place(x=70,y=80)

L2 = Variable
L2= Entry (aa, width=7)
L2.place(x=90,y=100)

我认为错误就在这里

m = L1.get()
Z = L2.get()

我认为错误也在这里

int=(Z)
int=(m)

PD = (Z*m)
AD = (m)
DD = (1.25*m)
WD = (2*m)
TD = (2.25*m)
OD = ((Z+2)*m)
TT = (1.5708*m)
CC = (0.25*m)
CP = (3.1428*m)
RF = (0.4*m)

PD=str(PD)
AD=str(AD)
DD=str(DD)
WD=str(WD)
TD=str(TD)
OD=str(OD)
TT=str(TT)
CC=str(CC)
CP=str(CP)
RF=str(RF)

s = Label (aa, text="SOLUTION : ")
s.place(x=0,y=125)

pd = Label (aa, text="Pitch Diameter, d ="+PD)
pd.place(x=0,y=140)

ad = Label (aa, text="Addendum,      ha = "+AD)
ad.place(x=0,y=160)

dd = Label (aa, text="Dedendum,      hd = "+DD)
dd.place(x=0,y=180)

wd = Label (aa, text="Working Depth,    = "+WD)
wd.place(x=0,y=200)

td = Label (aa, text="Tooth Depth,    h = "+TD)
td.place(x=0,y=220)

od = Label (aa, text="Outside Diameter OR Blank Diameter, D = "+OD)
od.place(x=0,y=240)

tt = Label (aa, text="Tooth Thickness, S = "+TT)
tt.place(x=0,y=260)

cc = Label (aa, text="Clearance,       C = "+CC)
cc.place(x=0,y=280)

cp = Label (aa, text="Circular Pitch,  p = "+CP)
cp.place(x=0,y=300)

rf = Label (aa, text="Radius of Fillet   = "+RF)
rf.place(x=0,y=320)

sc = Label (aa, text="SELECTION OF CUTTER: ")
sc.place(x=0,y=350)

cs = Label (aa, text="selected cutter is:  ")
cs.place(x=0,y=370)

aa.mainloop()

请解决错误,我知道我犯了一个愚蠢的错误,但我想知道它是什么....这只是机械中的一个简单问题。英格。

4

1 回答 1

3

要将输入转换为int(),请int()用作函数。它返回转换后的值:

Z=int(Z)
m=int(m)

您的代码改为先分配Z,然后分配m给本地名称int,屏蔽内置。

你的下一个问题是你没有给用户任何机会在你的程序中输入文本。我建议您多阅读一些 TKinter GUI 教程;直到您开始主循环,您的最终用户才会与您的 UI 进行交互并输入文本。

于 2013-07-05T09:11:03.740 回答