Quiz making in Tkinter with RadioButton and CommandButton -
i'm trying create quiz in tkinter. i'd use radiobuttons multiple choices, don't know how connect selected choice commandbutton. found similar program 1 i'm trying create,but still don't understand it. please me?
i fail understand why in function called call(par)
, command command =lambda: call(correct.get())
import tkinter tk root = tk.tk() def call(par): if par: lab2 = tk.label(root, text='corect!!!!').grid(row=4) else: lab2 = tk.label(root, text='of corse wrong').grid(row=4) lab2 = tk.label(root, text='how stupid?').grid(row=5) correct = tk.booleanvar() rad = tk.radiobutton(root, text='yes', variable=correct, value=true) rad2 = tk.radiobutton(root, text='no', variable=correct, value=false) lab = tk.label(root, text='is maker awsome?') btn = tk.button(root, text='submit', command=lambda: call(correct.get())) lab.grid(row=0) rad.grid(row=2, column=0) rad2.grid(row=2, column=1) btn.grid(row=3) tk.mainloop()
Comments
Post a Comment