import tkinter
cont = 0
window_main = tkinter.Tk(className='Lista de tarefas' )
window_main.geometry("450x250")
window_main.resizable(False,False)
check_1 = tkinter.IntVar()
check_2 = tkinter.IntVar()
check_3 = tkinter.IntVar()
def check1Clicked():
if check_1.get():
global cont
cont = cont +1
resultado_lb['text'] = cont
else:
cont = cont - 1
resultado_lb['text'] = cont
def check2Clicked():
if check_2.get():
global cont
cont = cont + 1
resultado_lb['text'] = cont
else:
cont = cont - 1
resultado_lb['text'] = cont
def check3Clicked():
if check_3.get():
global cont
cont = cont + 1
resultado_lb['text'] = cont
else:
cont = cont - 1
resultado_lb['text'] = cont
check_but_1 = tkinter.Checkbutton(window_main, text='Listening to Music',
variable=check_1,
onvalue=1, offvalue=0, command=check1Clicked)
check_but_1.pack()
check_but_2 = tkinter.Checkbutton(window_main, text='Reading Books',
variable=check_2,
onvalue=1, offvalue=0, command=check2Clicked)
check_but_2.pack()
check_but_3 = tkinter.Checkbutton(window_main, text='Watching Movies',
variable=check_3,
onvalue=1, offvalue=0, command=check3Clicked)
check_but_3.pack()
resultadoi_lb = tkinter.Label(window_main,text= 'Número de Tarefas concluídas',
font=("Helvetica", '11','bold'),bg="black",fg="white")
resultadoi_lb.place(relx=0.25, rely=0.6)
resultado_lb = tkinter.Label(window_main,text= '0',font=("Helvetica", '12','bold'),
bg="black",fg="white")
resultado_lb.place(relx=0.25, rely=0.7,relwidth=0.49)
window_main.mainloop()
Comentários
Enviar um comentário