Scale 尺度
作者:互联网
import tkinter as tk window = tk.Tk() window.title("daxiangcai's title") window.geometry('800x400') def printselection(v): # scale会自动传入参数 l.config(text='you have selected ' + v) l = tk.Label(window, bg='green', width=20) l.pack() s = tk.Scale(window, label='first scale', from_=1, to=10, orient=tk.HORIZONTAL, length=200, showvalue=0, tickinterval=2, resolution=0.01, command=printselection) # 这里的length以像素为单位,showvalue代表是否在滑块上面显示值,tickinterval代表显示的单位长度,resolution代表保留的小数位数 s.pack() window.mainloop()
标签:scale,title,尺度,window,Scale,tk,showvalue 来源: https://www.cnblogs.com/daxiangcai/p/16448695.html