2013-07-05 25 views
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) 

的非INT繁衍序列我認爲錯誤是在這裏有些地方無法按類型「STR」

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

請包括* full * traceback;它確切地告訴我們*發生異常的地方(而不是'在某處')。 –

+0

如果你稍微描述一下這個錯誤,這也會很有幫助。 –

回答

3

要將輸入轉換爲int(),請使用int()作爲函數。它返回轉換的結果:

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

你的代碼,而不是指派的第一Z,然後m到本地名int,掩蓋了內置。

您的下一個問題將是您沒有給用戶任何機會在您的程序中輸入文本。我建議你再閱讀一些TKinter GUI教程;直到你開始主循環,你的最終用戶才能與你的UI交互並輸入文本。

相關問題