[英]Configure widget from command of other widget in tkinter
我有一个复选框和两个刻度。 如果未选中该复选框,我想将比例设置为0并使用configure禁用它们。
我不知道如何从复选框的命令更改比例。
alp = Checkbutton( self, variable = self.ifalphagrams,
onvalue = 'yes',
offvalue = 'no',
command = disscale
)
soundspeed2 = Scale( self, from_ = 0,
to = 10,
resolution = 1,
orient = HORIZONTAL,
variable = self.alphaletter
)
以上是两个要素,如果有帮助的话。
尝试在“ disscale”函数中使用if else:
def disscale(self, event):
a = int(alp.get())
if a==1:
##display soundspeed2
else:
##Dont display soundspeed2
希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.