标签:gif sele http man The sdn c++ == pack
window = tk.Tk()
window.title(‘my window‘)
window.geometry(‘500x500‘)
var1 = tk.StringVar()
l = tk.Label(window, bg=‘yellow‘, width=4, textvariable=var1)
l.pack()
window.mainloop() # 不断刷新主窗口
var1 = tk.IntVar()
var2 = tk.IntVar()
c1 = tk.Checkbutton(window, text=‘Python‘, variable=var1, onvalue=1, offvalue=0,
command=print_selection)
c2 = tk.Checkbutton(window, text=‘C++‘, variable=var2, onvalue=1, offvalue=0,
command=print_selection)
c1.pack()
c2.pack()
def print_selection():
if (var1.get() == 1) & (var2.get() == 0):
l.config(text=‘I love only Python ‘)
elif (var1.get() == 0) & (var2.get() == 1):
l.config(text=‘I love only C++‘)
elif (var1.get() == 0) & (var2.get() == 0):
l.config(text=‘I do not love either‘)
else:
l.config(text=‘I love both‘)
标签:gif sele http man The sdn c++ == pack
原文地址:https://www.cnblogs.com/cloud-ken/p/12639926.html