这是两个按钮
second_year_icon = tk.PhotoImage(file = r"D:\Academy Management Application\Icons\2nd_year_icon.png")
global second_year_btn
second_year_btn = tk.Button(label_frame, font=LARGE_FONT, image=second_year_icon,
border=0 ,command=lambda : controller.show_frame(second_year) )
second_year_btn.grid(row=0 , column =0, padx=(10,10) , pady=(10,0), sticky=tk.E)
first_year_icon=tk.PhotoImage(file = r"D:\Academy Management
Application\Icons\1st_year_icon.png")
global first_year_btn
first_year_btn = tk.Button(label_frame, font=LARGE_FONT, image=first_year_icon
, command=lambda : controller.show_frame(second_year), border=0 )
first_year_btn.grid(row=0 , column =1, padx=(10,10) , pady=(10,0), sticky=tk.E)
现在,如果单击first_year_btn,当我单击second_year_btn时,它也会显示相同的数据。我知道我犯了一些愚蠢的错误,但是哪一个都不是。我非常紧张。谁能帮我吗?
reader = DictReader(f, delimiter=',')
for row in reader:
if first_year_btn:
if row['Class Name'] == '09th':
registration_no= row['Registration No']
student_name = row['Student Name']
f_name = row['Father Name']
gender = row['Gender']
class_name =row['Class Name']
class_session =row['Class Session']
admission_date =row['Admission Date']
monthly_fee = row['Monthly Fee']
dues_payment=row['Dues']
tree.insert("", 0, values=(registration_no, student_name, f_name,gender,class_name,class_session,admission_date,monthly_fee,dues_payment))
elif second_year_btn :
if row['Class Name'] == 'Second Year':
registration_no = row['Registration No']
student_name = row['Student Name']
f_name = row['Father Name']
gender = row['Gender']
class_name = row['Class Name']
class_session = row['Class Session']
admission_date = row['Admission Date']
monthly_fee = row['Monthly Fee']
dues_payment = row['Dues']
tree.insert("", 0, values=(
registration_no, student_name, f_name, gender, class_name, class_session, admission_date,
monthly_fee, dues_payment))