Python中tkinter中控件的使用(9,Scale拖拽器)


import tkinter

win = tkinter.Tk()
win.title("银行系统")
win.geometry("800x600+600+100")
'''
供用户通过拖拽指示器改变变量的值,可以水平,也可以垂直
orient 设置指示器方向(水平,垂直)
tkinter.HORIZONTAL 水平
tkinter.VERTICAL 垂直
length 水平时表示宽度,垂直时表示高度
tickinterval 选择值将会为该值的倍数
'''
#默认垂直,由上向下
scale=tkinter.Scale(win,from_=0,to=100,orient=tkinter.HORIZONTAL,
tickinterval=100,length=200)
scale.pack()
#设置初始值
scale.set(20)

def showNum():
print(scale.get())
tkinter.Button(win,text="打印",command=showNum).pack()


win.mainloop()

猜你喜欢

转载自www.cnblogs.com/zlong123/p/10498143.html
今日推荐