【发布时间】:2019-09-10 10:12:59
【问题描述】:
我想在 Python 中的 tkinter 中制作三个比例滑块,我可以在其中移动前两个滑块,第三个滑块作为前两个滑块值的总和自行移动
我尝试使用以下代码将前两个的值设置为第三个。
from tkinter import *
master = Tk()
#First Scale
w1=Scale(master, from_=0, to=100,orient=HORIZONTAL)
w1.pack()
#Second Scale
w2=Scale(master, from_=0, to=200,orient=HORIZONTAL)
w2.pack()
#Third Scale where sum has to be shown
w3=Scale(master, from_=0, to=300,orient=HORIZONTAL)
w3.set(w1.get()+w2.get())
w3.pack()
mainloop()
预期是移动前两个滑块,第三个滑块将自身移动到前两个滑块值之和的值。
【问题讨论】:
标签: python tkinter tkinter-scale