May-14-2020, 02:07 PM
(This post was last modified: May-14-2020, 02:43 PM by scratchmyhead.)
I have a checkbutton in my program but when I click the checkbox, it gives me the following error: TypeError: get() missing 1 required positional argument: 'self' Below is the code along with the related function.
def getreservation(): global arrivaldtee global my_box global conf global laste global firste global addresse global citye global statee global zipe global phonee global emaile global arrivale global departe global dayse global adultse global childrene global roomnum global ratee global taxe global dailye global staye global rateplancombo global paymente global rateplane global checksmoke global checkpet global notese global ide global confnume global var3 global var10 global var13 greserve = Toplevel() greserve.title('Retrieve Reservations') greserve.state('zoomed') #greserve.geometry("1400x800+250+50") greserve.configure(bg='#AFEEEE') now = dt.datetime.now() newdate = now + timedelta(days=1) diff = newdate - now diff2 = str(diff) labelintro = Label(greserve, text="Retrieve Reservation", bg="#AFEEEE") labelintro.config(font=("Times New Roman", 16)) labelintro.place(x=10, y=0) last = Label(greserve, text="Last", bg="#AFEEEE") last.place(x=35, y=30) laste = Entry(greserve, width=30) laste.place(x=70, y=30) first = Label(greserve, text="First", bg="#AFEEEE") first.place(x=35, y=50) firste = Entry(greserve, width=30) firste.place(x=70, y=50) address = Label(greserve, text="Address", bg="#AFEEEE") address.place(x=16, y=70) addresse = Entry(greserve, width=50) addresse.place(x=70, y=70) city = Label(greserve, text="City", bg="#AFEEEE") city.place(x=35, y=90) citye = Entry(greserve, width=40) citye.place(x=70, y=90) state = Label(greserve, text="State", bg="#AFEEEE") state.place(x=320, y=90) statee = Entry(greserve, width=20) statee.place(x=355, y=90) zip = Label(greserve, text="Zip Code", bg="#AFEEEE") zip.place(x=15, y=110) zipe = Entry(greserve, width=10) zipe.place(x=70, y=110) phone = Label(greserve, text="Phone", bg="#AFEEEE") phone.place(x=27, y=130) phonee = Entry(greserve, width=20) phonee.place(x=70, y=130) email = Label(greserve, text="Email", bg="#AFEEEE") email.place(x=27, y=150) emaile = Entry(greserve, width=50) emaile.place(x=70, y=150) line = Label(greserve, text="=======================================================", bg="#AFEEEE") line.place(x=0, y=170) arrival = Label(greserve, text="Arrival Date", bg="#AFEEEE") arrival.place(x=33, y=190) arrivale = Entry(greserve, width=20) arrivale.place(x=110, y=190) arrivale.bind("<Button-1>", aexample1) # dayss = now.strftime("%m-%d-%Y") + 1 depart = Label(greserve, text="Departure Date", bg="#AFEEEE") depart.place(x=15, y=210) departe = Entry(greserve, width=20) departe.place(x=110, y=210) departe.bind("<Button-1>", example1) days = Label(greserve, text="Days", bg="#AFEEEE") days.place(x=70, y=230) rvar11 = DoubleVar() dayse = Entry(greserve, textvariable=rvar11, width=20) dayse.delete(0, END) dayse.place(x=110, y=230) adults = Label(greserve, text="Adults", bg="#AFEEEE") adults.place(x=62, y=250) adultse = Entry(greserve, width=20) adultse.place(x=110, y=250) children = Label(greserve, text="Children", bg="#AFEEEE") children.place(x=54, y=270) childrene = Entry(greserve, width=20) childrene.place(x=110, y=270) options = [ "Select Room", ] conn = sqlite3.connect('roominventory.db') c = conn.cursor() c.execute("SELECT * FROM rooms") records = c.fetchall() for record in records: if record[3] != "N": addie = record[0:2] options.append(addie) room = Label(greserve, text="Room", bg="#AFEEEE") room.place(x=67, y=290) roomnum = Entry(greserve, width=20) roomnum.place(x=110, y=290) checkincombbo = ttk.Combobox(greserve, width=17, value=options) checkincombbo.place(x=245, y=290) checkincombbo.current(0) checkincombbo.bind("<<ComboboxSelected>>", comboroom) ratel = Label(greserve, text="Rate", bg="#AFEEEE") ratel.place(x=75, y=310) ratee = Entry(greserve, width=20) ratee.place(x=110, y=310) ratee.bind("<Return>", changerate) tax = Label(greserve, text="Tax", bg="#AFEEEE") tax.place(x=80, y=330) taxe = Entry(greserve, width=20) taxe.place(x=110, y=330) var13 = IntVar() checktax = Checkbutton(greserve, bg="#AFEEEE", onvalue=1, command=rtaxselect, variable=var13) checktax.place(x=55, y=330) checktax.select() daily = Label(greserve, text="Daily Amount", bg="#AFEEEE") daily.place(x=27, y=350) dailye = Entry(greserve, width=20) dailye.place(x=110, y=350) stay = Label(greserve, text="Stay Amount", bg="#AFEEEE") stay.place(x=30, y=370) staye = Entry(greserve, width=20) staye.place(x=110, y=370) options2 = [ "Select Rate Plan", "RACK", "AAA", "Senior", "Government", "Trucker", "---", "---", "---", ] rateplan = Label(greserve, text="Rate Plan", bg="#AFEEEE") rateplan.place(x=50, y=390) rateplane=Entry(greserve, width=20) rateplane.place(x=110, y=390) rateplancombo = ttk.Combobox(greserve, width=17, value=options2) rateplancombo.place(x=245, y=390) rateplancombo.current(0) rateplancombo.bind("<<ComboboxSelected>>", rateplan) payment = Label(greserve, text="Payment", bg="#AFEEEE") payment.place(x=50, y=410) paymente = Entry(greserve, width=20) paymente.place(x=110, y=410) var10 = IntVar() checksmoke = Checkbutton(greserve, text="Smoker", bg="#AFEEEE", onvalue=1, offvalue=0, variable=var10, command=selectsmoke) checksmoke.place(x=105, y=440) var3 = IntVar() checkpet = Checkbutton(greserve, text="Pet", bg="#AFEEEE", command=petbox, variable=var3) checkpet.place(x=105, y=470) line2 = Label(greserve, text="=======================================================", bg="#AFEEEE") line2.place(x=0, y=490) my_box = Listbox(greserve, height=19, width=125) my_box.place(x=600, y=180) my_box.bind("<<ListboxSelect>>", checkinreservation) options5 = [ "Select Payment", "Visa", "Master Card", "Discover", "American Exp.", "Diners", "Cash", "Travelers Check", "Personal Check" ] paymentcombo = ttk.Combobox(greserve, width=17, value=options5) paymentcombo.place(x=245, y=410) paymentcombo.current(0) # paymentcombo.bind("<<ComboboxSelected>>", payselect) notes = Label(greserve, text="NOTES:", bg="#AFEEEE") notes.place(x=10, y=520) notese = Entry(greserve, width=73) notese.place(x=10, y=540) id = Label(greserve, text="ID", bg="#AFEEEE") id.place(x=40, y=565) ide=Entry(greserve, width=10) ide.place(x=60, y=565) confnum=Label(greserve, text="Conf. #", bg="#AFEEEE") confnum.place(x=10, y=585) confnume = Entry(greserve, width=10) confnume.place(x=60, y=585) checkin = Button(greserve, text="Check In", command=checkinreserve) checkin.place(x=1300, y=500) update = Button(greserve, text="Update Reservation", command=updatereserve) update.place(x=1150, y=500) ext = Button(greserve, text="Exit-->", command=greserve.destroy) ext.place(x=1090, y=500) arrivaldte = Label(greserve, text="Arrival Date", bg="#AFEEEE") arrivaldte.place(x=600, y=160) arrivaldtee =Entry(greserve, width=20) arrivaldtee.place(x=675, y=160) arrivaldtee.bind("<Button-1>", rexample1) search=Button(greserve, text="Search....", command=searcharrival) search.place(x=800, y=155) searchall = Button(greserve, text="Search All", command=searchallres) searchall.place(x=875, y=155) searchconf = Label(greserve, text="Confirmation#", bg="#AFEEEE") searchconf.place(x=980, y=160) conf = Entry(greserve, width=20) conf.place(x=1070, y= 160) confbtn = Button(greserve, text="Go...", command=searchconfn) confbtn.place(x=1200, y=155) def rtaxselect(): print(var13) if var13.get() == 0: taxe.delete(0, END)