tkiner Scale组件的问题
当我拖动scale,上面的字体会随着数值大小改变,我应该怎么做 import tkinter as tkroot = tk.Tk()
root.geometry("500x300")
lab = tk.Label(root,text='人生苦短,吃一碗少一碗',font=('微软雅黑',10),height=3)
lab.pack()
def ds(x):
lab.config(font=('微软雅黑',10+int(s.get())))
print(s.get())
print(type(s.get()))
# 创建一个滑块条,长度200字符,从0开始10结束,以2为刻度,精度为1,横向排列,默认在0
s = tk.Scale(root,label='拖动试试',from_=0,to=10,orient=tk.HORIZONTAL,length=200,tickinterval=2,resolution=1,command=ds)
# s = tk.Scale(root,label='拖动试试',from_=0,to=50,orient=tk.HORIZONTAL,length=200,showvalue=0,tickinterval=2,resolution=0.1,command=ds)
s.pack()
root.mainloop() 笨鸟学飞 发表于 2020-12-21 13:12
人生苦短,吃一碗少一碗{:10_247:}
页:
[1]