我的问题是我有一个刻度和一个旋转框,它们可以改变彼此的值。例如,如果两者都从1到100,如果我将比例设置为50,则数字调整框也将更改,反之亦然。现在除了一个小问题外,我已经让它运行得很好了。我没法让ttk量表按整数递增。每次我改变刻度,我的数字后面都有一大堆小数。这是我的代码:
def create_widgets(self):
"""my widgets"""
spinval = IntVar()
self.scale = ttk.Scale(self, orient = HORIZONTAL,
length = 200,
from_ = 1, to = 100,
variable = spinval)
self.scale.grid(row = 3,column = 1,sticky = W)
self.spinbox = Spinbox(self, from_ = 1, to = 100,
textvariable = spinval,
command = self.update,
width = 10)
self.spinbox.grid(row = 3,column =3,sticky = W)
def update(self, nothing):
"""Updates the scale and spinbox"""
self.scale.set(self.spinbox.get())
现在我的问题是:有没有可能使它以整数递增,或者改变正常的Tkinter比例尺的图形,使它看起来更好。欢迎任何帮助。在
相关问题 更多 >
编程相关推荐