Hey guys,
I'm new to python and tkinter and am building a quote module thats interface is up and running but the button definitions arent working and i get an error when my "QUOTE" button is pressed. Please help.
Please help! Thank you very much!
I'm new to python and tkinter and am building a quote module thats interface is up and running but the button definitions arent working and i get an error when my "QUOTE" button is pressed. Please help.
Code:
ERROR: Traceback (most recent call last): TypeError: unsupported operand type(s) for +: 'type' and 'str'
Code:
CODE:
from Tkinter import *
import Pmw
##### ROOT WINDOW SET UP #####
root = Tk()
root.geometry("320x480+200+200")
root.title("procedure module")
Pmw.initialise(root)
##### ENTRY WIDGETS ####
GName_Entry=StringVar()
GName_Entry=Pmw.EntryField(root, validate = {'validator' : 'alphabetic', 'max' : 10}).grid(row=4, column=1)
SName_Entry=StringVar()
SName_Entry=Pmw.EntryField(root, validate = {'validator' : 'alphabetic', 'max' : 10}).grid(row=4, column=2)
Email_Entry=StringVar()
Email_Entry=Pmw.EntryField(root, validate = {'max' : 30}).grid(row=6, column=1)
BalloonHours_Entry=IntVar()
BalloonHours_Entry=Pmw.EntryField(root, validate = {'validator' : 'numeric', 'max' : 48}).grid(row=6, column=2)
PeopleCharge_Entry=IntVar()
PeopleCharge_Entry=Pmw.EntryField(root, validate = {'validator' : 'numeric', 'max' : 20}).grid(row=8, column=1)
LunchRequest_Entry=IntVar()
LunchRequest_Entry=Pmw.EntryField(root, validate = {'validator' : 'numeric', 'max' : 20}).grid(row=8, column=2)
SouvenirRequest_Entry=IntVar()
SouvenirRequest_Entry=Pmw.EntryField(root, validate = {'validator' : 'numeric', 'max' :20}).grid(row=10,column=1)
SubTotal_Entry=IntVar()
SubTotal_Entry=Pmw.EntryField(root).grid(row=13, column=1)
GST_Entry=IntVar()
GST_Entry=Pmw.EntryField(root).grid(row=13, column=2)
Total_Entry=IntVar()
Total_Entry=Pmw.EntryField(root).grid(row=15, column=2)
#### BUTTON FUNCTIONS ####
def calculation():
SubTotal_Entry.delete(0,END)
STResult=BalloonHours_Entry.getvalue()*100+PeopleCharge_Entry.getvalue()*70+LunchRequest_Entry.getvalue()*50+SouvenirRequest_Entry.getvalue()*20
SubTotal_Entry.insert(END,STResult)
GST_Entry.delete(0,END)
GSTResult=SubTotal_Entry.getvalue()*0.10
GST_Entry.insert(END,GSTResult)
Total_Entry.delete(0,END)
TResult=SubTotal_Entry.getvalue()+GST_Entry.getvalue()
# defines quote button and allows calculations to be completed
def cleardef():
GName_Entry.delete(0,END)
SName_Entry.delete(0,END)
Email_Entry.delete(0,END)
BalloonHours_Entry.delete(0,END)
PeopleCharge_Entry.delete(0,END)
LunchRequest_Entry.delete(0,END)
SouvenirRequest_Entry.delete(0,END)
SubTotal_Entry.delete(0,END)
GST_Entry.delete(0,END)
Total_Entry.delete(0,END)
# defines clear button and allows entry boxes to be cleared from any input
#### BUTTONS ####
#Quote button
QB=Button(root,text="QUOTE", width=10, command=calculation).grid(row=10, column=2)
#Clear button
CB=Button(root,text="CLEAR", width=10, command=cleardef).grid(row=18, column=1)
##### EXECUTE PROGRAM #####
root.mainloop()
Comment