1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| import tkinter as tk
def Page1():
frame_page1=tk.Frame(root)
frame_page1.grid(row=2,column=0)
titre_question_1=tk.Label(frame_page1,text='Questions :',font='bold').grid(row=0,sticky='w',columnspan=2,ipadx=3,ipady=3)
def question_1():
frame_question_1=tk.Frame(frame_page1)
frame_question_1.grid(row=1,column=0,sticky='w')
def Cancel_question_1():
frame_question_1.destroy()
question_1()
def question():
global organisation_yes_question_1,organisation_no_question_1
def answer_no_2():
organisation_no_question_12['bg']='red'
organisation_yes_question_12['state']='disabled'
print('Ah')
organisation_Cancel.grid(row=2,column=2)
def answer_yes_2():
organisation_yes_question_12['bg']='red'
organisation_no_question_12['state']='disabled'
print("oui c'est vrai qu'il fait mauvais temps")
organisation_Cancel.grid(row=2,column=2)
def answer_yes_1():
organisation_yes_question_1['bg']='green'
organisation_no_question_1['state']='disabled'
print("ok")
organisation_Cancel.grid(row=0,column=2)
def answer_no_1():
global organisation_yes_question_12,organisation_no_question_12
organisation_no_question_1['bg']='red'
organisation_yes_question_1['state']='disabled'
question_1_question_12=tk.Label(frame_question_1,text='a cause du mauvais temps ?',justify="left").grid(row=2,column=0,sticky='w',ipadx=3,ipady=3)
organisation_yes_question_12=tk.Button(frame_question_1,text='yes',command=answer_yes_2)
organisation_yes_question_12.grid(row=3,column=0,sticky='w')
organisation_no_question_12=tk.Button(frame_question_1,text='no',command=answer_no_2)
organisation_no_question_12.grid(row=3,column=1,sticky='w')
organisation_Cancel.grid(row=0,column=2)
question_1_question_1=tk.Label(frame_question_1,text='Salut, ça va ?',justify="left").grid(row=0,column=0,sticky='w',ipadx=3,ipady=3)
organisation_yes_question_1=tk.Button(frame_question_1,text='Yes',command=answer_yes_1)
organisation_yes_question_1.grid(row=1,column=0,sticky='w')
organisation_no_question_1=tk.Button(frame_question_1,text='No',command=answer_no_1)
organisation_no_question_1.grid(row=1,column=1,sticky='w')
organisation_Cancel=tk.Button(frame_question_1,text='Cancel',command=Cancel_question_1)
question()
question_1()
root=tk.Tk()
Page1()
root.mainloop() |
Partager