user2553043
user2553043

Reputation: 9

can't multiply sequence by non-int of type 'str'

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)

i think the error is here some where

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

i think the error is here some where also

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()

please solve the error , i know i am doing a silly mistake but i want to know what it is.... this is just a simple problem in mech. engg.

Upvotes: 0

Views: 1068

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1124110

To convert your inputs to int(), use int() as a function. It returns the converted value:

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

Your code instead assigned first Z, then m to a local name int, masking the built-in.

Your next problem will be that you didn't give the user any chance to enter text into your program. I recommend you read up on some TKinter GUI tutorials some more; not until you start the main loop does your end user get to interact with your UI and enter text.

Upvotes: 3

Related Questions