Hi, On Sat, 2 Dec 2017 21:18:14 +0000 adil gourinda <rikudou__sen...@live.com> wrote:
> In "tkinter.Chechbutton()" and "tkinter.Radiobutton()" widgets if > the "tristatevalue" option is set to an empty string the indicator > appears the first time in the 3rd state in which it is gray, but if I > check the button multiple times I can't put the indicator again in the > 3rd state, and if I set the "tristatevalue" to other value the > indicator doesn't appear in the 3rd state > Thank you for your help the third state can be accessed if the value of the button's variable is changed from outside of the widget itself, as in the following example (please note the difference in the checkbutton's appearance between the toggle() and toggle2() functions): ############################### from Tkinter import * root=Tk() v = StringVar(value='2') cb = Checkbutton(root, text='foobar', variable=v, onvalue='1', offvalue='0', tristatevalue='2') cb.pack(padx=100, pady=100) def toggle(ev): v.set('2')# tristatevalue -> third state is displayed cb.bind('<F1>', toggle) def toggle2(ev): v.set('3')# undefined value -> button appears unchecked cb.bind('<F2>', toggle2) root.mainloop() ############################### Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. Not one hundred percent efficient, of course ... but nothing ever is. -- Kirk, "Metamorphosis", stardate 3219.8 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org https://mail.python.org/mailman/listinfo/tkinter-discuss