I was trying to search about how to keep pressed a button until another button is pressed, I have an activebackground
color, when I press my button that color is activated only until I stop pressing it, what I want is to keep it pressed untill I press another button. Any advise let me know, thanks.
btn_main1 = Button(top, text='FRAME1', bg='gray', bd=3, fg='black',
activebackground='goldenrod', font='arial 12 bold', relief='solid',
command=lambda: [frame1()])
btn_main0.place(x=10, y=230, width='196', height='50')
btn_main2 = Button(top, text='FRAME2', bg='gray', bd=3, fg='black',
activebackground='goldenrod', font='arial 12 bold', relief='solid',
command=lambda :[frame2()])
btn_main.place(x=10, y=410, width='196', height='50')
I've thought a way to fake the pressed button. It's working well now. Thanks guys!
def active0():
btn_main0.config(bg='goldenrod')
def disable0():
btn_main0.config(bg='gray')
def active1():
btn_main1.config(bg='goldenrod')
def disable1():
btn_main1.config(bg='gray')
btn_main0 = Button(top, text='FRAME1', bg='gray', bd=3, fg='black',
activebackground='goldenrod', font='arial 12 bold', relief='solid',
command=lambda: [frame1(), active0(), disable1()])
btn_main0.place(x=10, y=230, width='196', height='50')
btn_main1 = Button(top, text='FRAME2', bg='gray', bd=3, fg='black',
activebackground='goldenrod', font='arial 12 bold', relief='solid',
command=lambda :[frame2(), active1(), disable0()])
btn_main1.place(x=10, y=410, width='196', height='50')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.