This is a part of my GUI program that I'm having a problem with and hoping someone could help me. What I'm trying to do is, when you click the check button, it should show the price on the text widget but when I click the check button it gives me an error:
File "E:\Phython\Theater.py", line 147, in update_text if self.matinee_price.get(): AttributeError: 'Checkbutton' object has no attribute 'get'
def matinee_pricing(self):
#Purchase Label
self.theater_label = tkinter.Label(text='Purchase Theater Seats Here', font=('Verdana', 15, 'bold'))
self.theater_label.grid(row=2, column=10)
#Checkbutton
self.matinee_price = BooleanVar()
self.matinee_price = tkinter.Checkbutton(text = '101 \nthru \n105', font=('Verdana', 10), bg='light pink', height=5, width=10,\
variable = self.matinee_price, command = self.update_text)
self.matinee_price.grid(row=5, column=9)
self.result = tkinter.Text(width=10, height=1, wrap = WORD)
self.result.grid(row=20, column=10)
def update_text(self):
price = ''
if self.matinee_price.get():
price += '$50'
self.result.delete(0.0, END)
self.result.insert(0.0, price)