Я хотел сделать отдельный вопрос, который не будет отклоняться от оригинальной темы (учитывая отрицательные отзывы, которые у него были из-за моего невнимания к правилам форума)
По какой-то странной причине я сделалновое окно с именем Questionnaire
:
def Questionnaire():
quiz_page = Tk()
quiz_page.title('Questionnaire')
quiz_page.geometry('600x350')
greet = Label(quiz_page, text='Welcome to the questionnaire! You will '
'answer a few questions to produce a result '
'for both you and your teacher to see!')
greet.grid(row=0,column=0)
, которое я затем вызвал на страницу входа учащегося.
def student_menu():
#student_login.destroy()
student_page = Tk()
student_page.title('Hello student')
student_page.geometry('300x130')
Welcome_msg = Label(student_page, text='Welcome').pack()
Questionnaire = Button(student_page,text='Quiz',command=Questionnaire).pack()
View = Button(student_page,text='View',command=view).pack()
Но когда я захожу в приложение, я получаю окно безкнопки и эта ошибка.
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Hassan Nur\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:\Users\Hassan Nur\Documents\Python - Programming Project\Project\Python Project\Python Project.py", line 78, in student_confirm
student_menu()
File "C:\Users\Hassan Nur\Documents\Python - Programming Project\Project\Python Project\Python Project.py", line 107, in student_menu
Questionnaire = Button(student_page,text='Quiz',command=Questionnaire).pack()
UnboundLocalError: local variable 'Questionnaire' referenced before assignment
Если возможно (или даже имеет право), не могли бы вы помочь?