Создаю приложение для сдачи экзаменов на Python как курсовую работу
Все плюс минус понятно и работает, но не могу понять который день как сделать так чтобы тест проходил на следующий вопрос без постоянного открытия нового окна. (То есть по нажатию одной кнопки удалять предыдущие вопросы и выводить новые) срок сдачи проекта уже скоро, а я перелопатил все что мог. Код ниже
import tkinter as tk
#Создание окна
win_chose = tk.Tk()
win_chose.config(bg='#292929')
win_chose.title('Программа тестироваия')
win_chose.geometry(f"{1000}x{600}+{(win_chose.winfo_screenwidth()-1000)//2}+
{(win_chose.winfo_screenheight()-600)//2}")
win_chose.resizable(False, False)
questions = tk.Label(win_chose,text='Какой тест будешь проходить?', pady=25,
bg='#292929', fg='white', font=('Arial', 28, 'bold')).pack()
#Изображение кнопок
im_continue = tk.PhotoImage(file=r'C:\Users\Debian\Desktop\ARGUS\Test
program\Image\Button\Button.png')
im_continue = im_continue.subsample(4, 3)
def Continue():
if test1_value.get() == 'Yes':
win_chose.destroy()
import test1
test1.window_test1()
print('test2', test2_value.get())
print('test3', test3_value.get())
test1_value = tk.StringVar()
test2_value = tk.StringVar()
test3_value = tk.StringVar()
test1_value.set('No')
test2_value.set('No')
test3_value.set('No')
#Выбор теста
test1 = tk.Checkbutton(win_chose, bg='#292929', activebackground='#292929', fg='black',
offvalue='No',, variable=test1_value)
test1_l = tk.Label(win_chose, text='1 тест', bg='#292929', fg='white', font=('Arial', 18, 'bold'))
test1.place(x=150, y=150)
test1_l.place(x=175, y=144)
test1.bind('<ButtonPress>',lambda event: test3.deselect())
test1.bind('<ButtonPress>',lambda event: test2.deselect(), '+')
test2 = tk.Checkbutton(win_chose, bg='#292929', activebackground='#292929', fg='black',
offvalue='No',, variable=test2_value)
test2_l = tk.Label(win_chose, text='2 тест', bg='#292929', fg='white', font=('Arial', 18, 'bold'))
test2.place(x=150, y=200)
test2_l.place(x=175, y=194)
test2.bind('<ButtonPress>',lambda event: test1.deselect())
test2.bind('<ButtonPress>',lambda event: test3.deselect(), '+')
test3 = tk.Checkbutton(win_chose, bg='#292929', activebackground='#292929', fg='black',
offvalue='No',, variable=test3_value)
test3_l = tk.Label(win_chose, text='3 тест', bg='#292929', fg='white', font=('Arial', 18, 'bold'))
test3.place(x=150, y=250)
test3_l.place(x=175, y=244)
test3.bind('<ButtonPress>',lambda event: test1.deselect())
test3.bind('<ButtonPress>',lambda event: test2.deselect(), '+')
btn_close = tk.Button(win_chose, image=im_continue, highlightthickness=0, bd=0,
text='Регистрация')
btn_close.configure(bg='#292929', activebackground='#292929')
btn_close.place(x=50, y=500, width=170, height=60)
btn_close.bind('<Enter>', lambda event: btn_close.place(x=52, y=502))
btn_close.bind('<Leave>', lambda event: btn_close.place(x=50, y=500))
btn_chose = tk.Button(win_chose, image=im_continue, highlightthickness=0, bd=0,
text='Регистрация', command=Continue)
btn_chose.configure(bg='#292929', activebackground='#292929')
btn_chose.place(x=800, y=500, width=170, height=60)
btn_chose.bind('<Enter>', lambda event: btn_chose.place(x=802, y=502))
btn_chose.bind('<Leave>', lambda event: btn_chose.place(x=800, y=500))
#r1.place(x=200, y=250)
#r1_l.place(x=225,y=244)
win_chose.mainloop()
Источник: Stack Overflow на русском