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()
请解决错误,我知道我在做一个愚蠢的错误,但我想知道它是什么......这只是一个简单的问题。 ENGG。
答案 0 :(得分:3)
要将输入转换为int()
,请使用int()
作为功能。它返回转换后的值:
Z=int(Z)
m=int(m)
您的代码首先分配给Z
,然后m
分配给本地名称int
,屏蔽内置代码。
您的下一个问题是您没有给用户任何机会在您的程序中输入文字。我建议你阅读一些TKinter GUI教程;直到您启动主循环,最终用户才能与您的UI进行交互并输入文本。