I have this code written for a GUI program. The question is Question 1 – Chapter 14 – Question 6 –
Joe’s Automotive performs the following routine maintenance services:
Oil Change--$26.00
Lube Job--#18.00
Radiator Flush--#30.00
Transmission Flush--$80.00
Inspection--$15.00
Muffler replacement--$100.00
Tire Rotation--$20.00
Write a GUI program with check buttons that allow the user to select any or all of these services. When the user clicks a button the total charges should be displayed. THIS IS MY CODE SO FAR, CAN someone tell me why it doesn't work??
##############################################################################
#
#
# Name: Marc DiFalco
#
# Lab: 13
#
# Description: GUI Lab on instructions
#
#
#
# Inputs: Type of job
# Outputs: Job done and price
# Variables:CheckVar1,CheckVar2,CheckVar3,CheckVar4,CheckVar5,CheckVar6,
# CheckVar7, totalvalue
#
#
#
#
#
###############################################################################
#import
from tkinter import *
root=Tk()
root.title("Some GUI")
root.geometry("400x700")
CheckVar1=IntVar()
CheckVar2=IntVar()
CheckVar3=IntVar()
CheckVar4=IntVar()
CheckVar5=IntVar()
CheckVar6=IntVar()
CheckVar7=IntVar()#Set the variables
totalvalue=0
#The user can check off which jobs they would like to purchase
Oil=Checkbutton(root,text="Oil Change 20.00",variable=CheckVar1,onvalue=20\
,offvalue=0,height=5,width=20)
Lube=Checkbutton(root,text="Lube Job 18.00",variable=CheckVar2,onvalue=18\
,offvalue=0,height=5,width=20)
RadiatorFlush=Checkbutton(root,text="Radiator Flush--$30.00",variable=CheckVar3,onvalue=30\
,offvalue=0,height=5,width=20)
Transmission=Checkbutton(root,text="Transmission Flush--80.00",variable=CheckVar4,onvalue=80\
,offvalue=0,height=5,width=20)
Inspection=Checkbutton(root,text="Inspection--15.00",variable=CheckVar5,onvalue=15\
,offvalue=0,height=5,width=20)
Muffler=Checkbutton(root,text="Muffler replacement--100.00",variable=CheckVar6,onvalue=100\
,offvalue=0,height=5,width=20)
Tire=Checkbutton(root,text="Tire Rotation--20.00",variable=CheckVar7,onvalue=20\
,offvalue=0,height=5,width=20)
somebutton=Button(root, text="Total")
#Call each job
Oil.pack()
Lube.pack()
RadiatorFlush.pack()
Transmission.pack()
Inspection.pack()
Muffler.pack()
Tire.pack()
somebutton.pack()
#main loop
root.mainloop()
"it doesn't work"? An error? Unexpected output, perhaps?somebutton=Button(root, text="Total")