Я получаю эту ошибку. AttributeError: у объекта '_tkinter.tkapp' нет атрибута 'pack_forget'. Подскажите пожалуйста что не так с кодом:
Я думаю, это потому, что я использовал place () вместо pack. Но я попытался изменить его на place_forget также. Не работает Вот код
class Question:
def check(self, letter, view):
global right
if(letter == self.correctLetter):
label = Label(view, text="RIGHT!",bg='black',fg='green',font=("Calibri 11 bold")).place(x=200,y=280)
right += 1
else:
label = Label(view, text="WRONG!",bg='black',fg='red',font=("Calibri 11 bold")).place(x=200,y=280)
## label.pack()
view.after(1000, lambda *args: self.unpackView(view))
def getView(self, screen10):
view = screen10
Label(view, text="Question: ",font=("Calibri",17)).place(x = 10, y = 10)
Label(view, text=self.question,font=("Calibri",20)).place(x = 10, y = 40)
Label(view, text="a : ",font=("Calibri",14)).place(x = 10, y = 100)
Label(view, text=self.answers[0],font=("Calibri",18)).place(x = 35, y = 95)
Label(view, text="b : ",font=("Calibri",14)).place(x = 10, y = 150)
Label(view, text=self.answers[1],font=("Calibri",18)).place(x = 35, y = 145)
Label(view, text="c : ",font=("Calibri",14)).place(x = 10, y = 200)
Label(view, text=self.answers[2],font=("Calibri",18)).place(x = 35, y = 195)
Label(view, text="d : ",font=("Calibri",14)).place(x = 10, y = 250)
Label(view, text=self.answers[3],font=("Calibri",18)).place(x = 35, y = 245)
tk.Button(view,text='Option_A',fg='black',bg='white',font=('calibri',11),command=lambda *args: self.check("A", view),height=1,width=10).place(x = 200, y = 100)
tk.Button(view,text='Option_B',fg='black',bg='white',font=('calibri',11),command=lambda *args: self.check("B", view),height=1,width=10).place(x = 200, y = 150)
tk.Button(view,text='Option_C',fg='black',bg='white',font=('calibri',11),command=lambda *args: self.check("C", view),height=1,width=10).place(x = 200, y = 200)
tk.Button(view,text='Option_D',fg='black',bg='white',font=('calibri',11),command=lambda *args: self.check("D", view),height=1,width=10).place(x = 200, y = 250)
return view
def unpackView(self, view):
view.pack_forget()
askQuestion()